@@ -152,19 +152,19 @@ public void testAggregationClock() {
152152 final Duration c11 = tester .getClock (key1 , owner1 ).orElseThrow ();
153153 final Duration c12 = tester .getClock (key1 , owner2 ).orElseThrow ();
154154
155- Assert .assertTrue (c11 .getNano ( ) > 0 );
156- Assert .assertTrue (c12 .getNano ( ) > 0 );
155+ Assert .assertTrue (c11 .compareTo ( Duration . ZERO ) > 0 );
156+ Assert .assertTrue (c12 .compareTo ( Duration . ZERO ) > 0 );
157157 Assert .assertEquals (tester .getClock (key1 ).orElseThrow (), c11 .plus (c12 ));
158158
159159 final Duration c21 = tester .getClock (key2 , owner1 ).orElseThrow ();
160160 final Duration c32 = tester .getClock (key3 , owner2 ).orElseThrow ();
161161
162- Assert .assertTrue (c21 .getNano ( ) > 0 );
163- Assert .assertTrue (c32 .getNano ( ) > 0 );
162+ Assert .assertTrue (c21 .compareTo ( Duration . ZERO ) > 0 );
163+ Assert .assertTrue (c32 .compareTo ( Duration . ZERO ) > 0 );
164164 Assert .assertEquals (tester .getClock (key2 , owner1 ).orElseThrow (), c21 );
165165 Assert .assertEquals (tester .getClock (key3 , owner2 ).orElseThrow (), c32 );
166166
167- Assert .assertEquals (new HashSet <>(tester .getClocks (key1 ).values ()), Set . of (c11 , c12 ));
167+ Assert .assertEquals (new HashSet <>(tester .getClocks (key1 ).values ()), new HashSet <>( Arrays . asList (c11 , c12 ) ));
168168 Assert .assertEquals (tester .getClocks (key2 ).values (), Collections .singleton (c21 ));
169169 Assert .assertEquals (tester .getClocks (key3 ).values (), Collections .singleton (c32 ));
170170
@@ -265,15 +265,15 @@ public void testInsertRetrievalClock() {
265265 Assert .assertEquals (statistics .getClock (KEY_CLOCK ).orElseThrow (), Duration .ZERO );
266266
267267 statistics .pauseClock (KEY_CLOCK );
268- final long nanos1 = statistics .getClock (KEY_CLOCK ).orElseThrow (). toNanos ();
269- Assert .assertTrue (nanos1 > 0L );
268+ Duration c1 = statistics .getClock (KEY_CLOCK ).orElseThrow ();
269+ Assert .assertTrue (c1 . compareTo ( Duration . ZERO ) > 0 );
270270
271271 statistics .startOrResumeClock (KEY_CLOCK );
272272 Assert .assertTrue (statistics .getClock (KEY_CLOCK ).isPresent ());
273273
274274 statistics .pauseClock (KEY_CLOCK );
275- final long nanos2 = statistics .getClock (KEY_CLOCK ).orElseThrow (). toNanos ();
276- Assert .assertTrue (nanos2 > nanos1 );
275+ Duration c2 = statistics .getClock (KEY_CLOCK ).orElseThrow ();
276+ Assert .assertTrue (c2 . compareTo ( c1 ) > 0 );
277277
278278 Assert .assertTrue (statistics .getText (KEY_TEXT ).isEmpty ());
279279 Assert .assertTrue (statistics .getFlag (KEY_FLAG ).isEmpty ());
@@ -444,6 +444,7 @@ public void testDisplay() {
444444 ============================================
445445 """ );
446446
447- Assert .assertTrue (pattern .matcher (statistics .print ()).matches ());
447+ String output = statistics .print ();
448+ Assert .assertTrue (pattern .matcher (output ).matches (), output );
448449 }
449450}
0 commit comments