test/java/time/tck/java/time/TCKClock_Tick.java

Print this page




 231         Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499));
 232         assertEquals(a.equals(d), false);
 233 
 234         assertEquals(a.equals(null), false);
 235         assertEquals(a.equals("other type"), false);
 236         assertEquals(a.equals(Clock.systemUTC()), false);
 237     }
 238 
 239     public void test_hashCode() {
 240         Clock a = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
 241         Clock b = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
 242         assertEquals(a.hashCode(), a.hashCode());
 243         assertEquals(a.hashCode(), b.hashCode());
 244 
 245         Clock c = Clock.tick(Clock.system(MOSCOW), Duration.ofMillis(500));
 246         assertEquals(a.hashCode() == c.hashCode(), false);
 247 
 248         Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499));
 249         assertEquals(a.hashCode() == d.hashCode(), false);
 250     }
 251 
 252     //-----------------------------------------------------------------------
 253     public void test_toString() {
 254         // spec requires "full state" in toString()
 255         Clock test = Clock.tick(Clock.system(PARIS), AMOUNT);
 256         assertEquals(test.toString().contains("Europe/Paris"), true);
 257         assertEquals(test.toString().contains("PT2S"), true);
 258     }
 259 
 260 }


 231         Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499));
 232         assertEquals(a.equals(d), false);
 233 
 234         assertEquals(a.equals(null), false);
 235         assertEquals(a.equals("other type"), false);
 236         assertEquals(a.equals(Clock.systemUTC()), false);
 237     }
 238 
 239     public void test_hashCode() {
 240         Clock a = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
 241         Clock b = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
 242         assertEquals(a.hashCode(), a.hashCode());
 243         assertEquals(a.hashCode(), b.hashCode());
 244 
 245         Clock c = Clock.tick(Clock.system(MOSCOW), Duration.ofMillis(500));
 246         assertEquals(a.hashCode() == c.hashCode(), false);
 247 
 248         Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499));
 249         assertEquals(a.hashCode() == d.hashCode(), false);
 250     }









 251 }