JUnit's assertEquals for doubles and floats takes a third argument which is the precision to check. Use that instead.