test/java/time/tck/java/time/TCKClock_System.java

Print this page




 180         assertEquals(d.equals(d), true);
 181 
 182         assertEquals(a.equals(c), false);
 183         assertEquals(c.equals(a), false);
 184 
 185         assertEquals(a.equals(null), false);
 186         assertEquals(a.equals("other type"), false);
 187         assertEquals(a.equals(Clock.fixed(Instant.now(), ZoneOffset.UTC)), false);
 188     }
 189 
 190     public void test_hashCode() {
 191         Clock a = Clock.system(ZoneOffset.UTC);
 192         Clock b = Clock.system(ZoneOffset.UTC);
 193         assertEquals(a.hashCode(), a.hashCode());
 194         assertEquals(a.hashCode(), b.hashCode());
 195 
 196         Clock c = Clock.system(PARIS);
 197         assertEquals(a.hashCode() == c.hashCode(), false);
 198     }
 199 
 200     //-----------------------------------------------------------------------
 201     public void test_toString() {
 202         // spec requires "full state" in toString()
 203         Clock test = Clock.system(PARIS);
 204         assertEquals(test.toString().contains("Europe/Paris"), true);
 205     }
 206 
 207 }


 180         assertEquals(d.equals(d), true);
 181 
 182         assertEquals(a.equals(c), false);
 183         assertEquals(c.equals(a), false);
 184 
 185         assertEquals(a.equals(null), false);
 186         assertEquals(a.equals("other type"), false);
 187         assertEquals(a.equals(Clock.fixed(Instant.now(), ZoneOffset.UTC)), false);
 188     }
 189 
 190     public void test_hashCode() {
 191         Clock a = Clock.system(ZoneOffset.UTC);
 192         Clock b = Clock.system(ZoneOffset.UTC);
 193         assertEquals(a.hashCode(), a.hashCode());
 194         assertEquals(a.hashCode(), b.hashCode());
 195 
 196         Clock c = Clock.system(PARIS);
 197         assertEquals(a.hashCode() == c.hashCode(), false);
 198     }
 199 







 200 }