Added unittest to check for threshold exceptions