Faster StopWatchTest.testStopInstantSimple()
- Replace Matcher calls with sane assertTrue()
This commit is contained in:
parent
695986b2b9
commit
b4e4c40af1
|
@ -351,13 +351,14 @@ public class StopWatchTest extends AbstractLangTest {
|
||||||
public void testStopInstantSimple() throws InterruptedException {
|
public void testStopInstantSimple() throws InterruptedException {
|
||||||
final StopWatch watch = StopWatch.createStarted();
|
final StopWatch watch = StopWatch.createStarted();
|
||||||
final long testStartMillis = System.currentTimeMillis();
|
final long testStartMillis = System.currentTimeMillis();
|
||||||
sleep(MILLIS_550);
|
sleep(TWO_MILLISECOND);
|
||||||
watch.stop();
|
watch.stop();
|
||||||
final long testEndMillis = System.currentTimeMillis();
|
final long testEndMillis = System.currentTimeMillis();
|
||||||
final Instant stopTime = watch.getStopInstant();
|
final Instant stopTime = watch.getStopInstant();
|
||||||
assertEquals(stopTime, watch.getStopInstant());
|
assertEquals(stopTime, watch.getStopInstant());
|
||||||
assertThat("stopTime", stopTime,
|
// Only less than, not equal
|
||||||
allOf(greaterThanOrEqualTo(Instant.ofEpochMilli(testStartMillis)), lessThanOrEqualTo(Instant.ofEpochMilli(testEndMillis))));
|
assertTrue(testStartMillis < testEndMillis);
|
||||||
|
assertTrue(Instant.ofEpochMilli(testStartMillis).isBefore(Instant.ofEpochMilli(testEndMillis)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue