Use assertEquals instead of assertTrue(Range.contains)

It likely will produce a better error message and doesn't require using
as large of an API/impl.
This commit is contained in:
Eric Anderson 2015-11-02 11:07:25 -08:00
parent 6229c2ca61
commit 7767138c96
1 changed files with 1 additions and 3 deletions

View File

@ -37,7 +37,6 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Range;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -102,11 +101,10 @@ public class CallOptionsTest {
long deadline = CallOptions.DEFAULT long deadline = CallOptions.DEFAULT
.withDeadlineAfter(1, TimeUnit.MINUTES).getDeadlineNanoTime(); .withDeadlineAfter(1, TimeUnit.MINUTES).getDeadlineNanoTime();
long expected = System.nanoTime() + 1L * 60 * 1000 * 1000 * 1000; long expected = System.nanoTime() + 1L * 60 * 1000 * 1000 * 1000;
long delta = deadline - expected;
// 10 milliseconds of leeway // 10 milliseconds of leeway
long epsilon = 1000 * 1000 * 10; long epsilon = 1000 * 1000 * 10;
assertTrue(Range.closed(-epsilon, epsilon).contains(delta)); assertEquals(expected, deadline, epsilon);
} }
@Test @Test