test/java/time/test/java/time/TestLocalDateTime.java

Print this page




 107             {0, 0, 1, 0},
 108             {0, 0, 1, 1},
 109             {0, 1, 0, 0},
 110             {0, 1, 0, 1},
 111             {0, 1, 1, 0},
 112             {0, 1, 1, 1},
 113             {1, 0, 0, 0},
 114             {1, 0, 0, 1},
 115             {1, 0, 1, 0},
 116             {1, 0, 1, 1},
 117             {1, 1, 0, 0},
 118             {1, 1, 0, 1},
 119             {1, 1, 1, 0},
 120             {1, 1, 1, 1},
 121         };
 122     }
 123 
 124     @Test(groups={"implementation"})
 125     public void test_withYear_int_noChange() {
 126         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withYear(2007);
 127         assertSame(t.getDate(), TEST_2007_07_15_12_30_40_987654321.getDate());
 128         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 129     }
 130 
 131     @Test(groups={"implementation"})
 132     public void test_withMonth_int_noChange() {
 133         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonth(7);
 134         assertSame(t.getDate(), TEST_2007_07_15_12_30_40_987654321.getDate());
 135         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 136     }
 137 
 138     @Test(groups={"implementation"})
 139     public void test_withDayOfMonth_noChange() {
 140         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withDayOfMonth(15);
 141         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 142     }
 143 
 144     @Test(groups={"implementation"})
 145     public void test_withDayOfYear_noChange() {
 146         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withDayOfYear(31 + 28 + 31 + 30 + 31 + 30 + 15);
 147         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 148     }
 149 
 150     @Test(groups={"implementation"})
 151     public void test_withHour_noChange() {
 152         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withHour(12);
 153         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 154     }
 155 
 156     @Test(groups={"implementation"})
 157     public void test_withHour_toMidnight() {
 158         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).withHour(0);
 159         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 160     }
 161 
 162     @Test(groups={"implementation"})
 163     public void test_withHour_toMidday() {
 164         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).withHour(12);
 165         assertSame(t.getTime(), LocalTime.NOON);
 166     }
 167 
 168     @Test(groups={"implementation"})
 169     public void test_withMinute_noChange() {
 170         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMinute(30);
 171         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 172     }
 173 
 174     @Test(groups={"implementation"})
 175     public void test_withMinute_toMidnight() {
 176         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 1)).withMinute(0);
 177         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 178     }
 179 
 180     @Test(groups={"implementation"})
 181     public void test_withMinute_toMidday() {
 182         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 1)).withMinute(0);
 183         assertSame(t.getTime(), LocalTime.NOON);
 184     }
 185 
 186     @Test(groups={"implementation"})
 187     public void test_withSecond_noChange() {
 188         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withSecond(40);
 189         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 190     }
 191 
 192     @Test(groups={"implementation"})
 193     public void test_withSecond_toMidnight() {
 194         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 1)).withSecond(0);
 195         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 196     }
 197 
 198     @Test(groups={"implementation"})
 199     public void test_withSecond_toMidday() {
 200         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 1)).withSecond(0);
 201         assertSame(t.getTime(), LocalTime.NOON);
 202     }
 203 
 204     @Test(groups={"implementation"})
 205     public void test_withNanoOfSecond_noChange() {
 206         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withNano(987654321);
 207         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 208     }
 209 
 210     @Test(groups={"implementation"})
 211     public void test_withNanoOfSecond_toMidnight() {
 212         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 0, 1)).withNano(0);
 213         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 214     }
 215 
 216     @Test(groups={"implementation"})
 217     public void test_withNanoOfSecond_toMidday() {
 218         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 0, 1)).withNano(0);
 219         assertSame(t.getTime(), LocalTime.NOON);
 220     }
 221 
 222     @Test(groups={"implementation"})
 223     public void test_plus_adjuster_zero() {
 224         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(Period.ZERO);
 225         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 226     }
 227 
 228     @Test(groups={"implementation"})
 229     public void test_plus_Period_zero() {
 230         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(MockSimplePeriod.ZERO_DAYS);
 231         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 232     }
 233 
 234     @Test(groups={"implementation"})
 235     public void test_plus_longPeriodUnit_zero() {
 236         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(0, ChronoUnit.DAYS);
 237         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 238     }
 239 


 253     public void test_plusWeeks_noChange() {
 254         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusWeeks(0);
 255         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 256     }
 257 
 258     @Test(groups={"implementation"})
 259     public void test_plusDays_noChange() {
 260         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusDays(0);
 261         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 262     }
 263 
 264     @Test(groups={"implementation"})
 265     public void test_plusHours_noChange() {
 266         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusHours(0);
 267         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 268     }
 269 
 270     @Test(groups={"implementation"})
 271     public void test_plusHours_toMidnight() {
 272         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 0)).plusHours(1);
 273         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 274     }
 275 
 276     @Test(groups={"implementation"})
 277     public void test_plusHours_toMidday() {
 278         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 0)).plusHours(1);
 279         assertSame(t.getTime(), LocalTime.NOON);
 280     }
 281 
 282     @Test(groups={"implementation"})
 283     public void test_plusMinutes_noChange() {
 284         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusMinutes(0);
 285         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 286     }
 287 
 288     @Test(groups={"implementation"})
 289     public void test_plusMinutes_noChange_oneDay_same() {
 290         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusMinutes(24 * 60);
 291         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 292     }
 293 
 294     @Test(groups={"implementation"})
 295     public void test_plusMinutes_toMidnight() {
 296         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59)).plusMinutes(1);
 297         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 298     }
 299 
 300     @Test(groups={"implementation"})
 301     public void test_plusMinutes_toMidday() {
 302         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59)).plusMinutes(1);
 303         assertSame(t.getTime(), LocalTime.NOON);
 304     }
 305 
 306     @Test(groups={"implementation"})
 307     public void test_plusSeconds_noChange() {
 308         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusSeconds(0);
 309         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 310     }
 311 
 312     @Test(groups={"implementation"})
 313     public void test_plusSeconds_noChange_oneDay_same() {
 314         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusSeconds(24 * 60 * 60);
 315         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 316     }
 317 
 318     @Test(groups={"implementation"})
 319     public void test_plusSeconds_toMidnight() {
 320         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59, 59)).plusSeconds(1);
 321         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 322     }
 323 
 324     @Test(groups={"implementation"})
 325     public void test_plusSeconds_toMidday() {
 326         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59, 59)).plusSeconds(1);
 327         assertSame(t.getTime(), LocalTime.NOON);
 328     }
 329 
 330     @Test(groups={"implementation"})
 331     public void test_plusNanos_noChange() {
 332         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusNanos(0);
 333         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 334     }
 335 
 336     @Test(groups={"implementation"})
 337     public void test_plusNanos_noChange_oneDay_same() {
 338         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusNanos(24 * 60 * 60 * 1000000000L);
 339         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 340     }
 341 
 342     @Test(groups={"implementation"})
 343     public void test_plusNanos_toMidnight() {
 344         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59, 59, 999999999)).plusNanos(1);
 345         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 346     }
 347 
 348     @Test(groups={"implementation"})
 349     public void test_plusNanos_toMidday() {
 350         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59, 59, 999999999)).plusNanos(1);
 351         assertSame(t.getTime(), LocalTime.NOON);
 352     }
 353 
 354     @Test(groups={"implementation"})
 355     public void test_minus_adjuster_zero() {
 356         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(Period.ZERO);
 357         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 358     }
 359 
 360     @Test(groups={"implementation"})
 361     public void test_minus_Period_zero() {
 362         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(MockSimplePeriod.ZERO_DAYS);
 363         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 364     }
 365 
 366     @Test(groups={"implementation"})
 367     public void test_minus_longPeriodUnit_zero() {
 368         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(0, ChronoUnit.DAYS);
 369         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 370     }
 371 


 385     public void test_minusWeeks_noChange() {
 386         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusWeeks(0);
 387         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 388     }
 389 
 390     @Test(groups={"implementation"})
 391     public void test_minusDays_noChange() {
 392         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusDays(0);
 393         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 394     }
 395 
 396     @Test(groups={"implementation"})
 397     public void test_minusHours_noChange() {
 398         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusHours(0);
 399         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 400     }
 401 
 402     @Test(groups={"implementation"})
 403     public void test_minusHours_toMidnight() {
 404         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).minusHours(1);
 405         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 406     }
 407 
 408     @Test(groups={"implementation"})
 409     public void test_minusHours_toMidday() {
 410         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(13, 0)).minusHours(1);
 411         assertSame(t.getTime(), LocalTime.NOON);
 412     }
 413 
 414     @Test(groups={"implementation"})
 415     public void test_minusMinutes_noChange() {
 416         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusMinutes(0);
 417         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 418     }
 419 
 420     @Test(groups={"implementation"})
 421     public void test_minusMinutes_noChange_oneDay_same() {
 422         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusMinutes(24 * 60);
 423         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 424     }
 425 
 426     @Test(groups={"implementation"})
 427     public void test_minusMinutes_toMidnight() {
 428         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 1)).minusMinutes(1);
 429         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 430     }
 431 
 432     @Test(groups={"implementation"})
 433     public void test_minusMinutes_toMidday() {
 434         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 1)).minusMinutes(1);
 435         assertSame(t.getTime(), LocalTime.NOON);
 436     }
 437 
 438     @Test(groups={"implementation"})
 439     public void test_minusSeconds_noChange() {
 440         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusSeconds(0);
 441         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 442     }
 443 
 444     @Test(groups={"implementation"})
 445     public void test_minusSeconds_noChange_oneDay() {
 446         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusSeconds(24 * 60 * 60);
 447         assertEquals(t.getDate(), TEST_2007_07_15_12_30_40_987654321.getDate().minusDays(1));
 448         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 449     }
 450 
 451     @Test(groups={"implementation"})
 452     public void test_minusSeconds_toMidnight() {
 453         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 1)).minusSeconds(1);
 454         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 455     }
 456 
 457     @Test(groups={"implementation"})
 458     public void test_minusSeconds_toMidday() {
 459         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 1)).minusSeconds(1);
 460         assertSame(t.getTime(), LocalTime.NOON);
 461     }
 462 
 463     @Test(groups={"implementation"})
 464     public void test_minusNanos_noChange() {
 465         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusNanos(0);
 466         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 467     }
 468 
 469     @Test(groups={"implementation"})
 470     public void test_minusNanos_noChange_oneDay() {
 471         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusNanos(24 * 60 * 60 * 1000000000L);
 472         assertEquals(t.getDate(), TEST_2007_07_15_12_30_40_987654321.getDate().minusDays(1));
 473         assertSame(t.getTime(), TEST_2007_07_15_12_30_40_987654321.getTime());
 474     }
 475 
 476     @Test(groups={"implementation"})
 477     public void test_minusNanos_toMidnight() {
 478         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 0, 1)).minusNanos(1);
 479         assertSame(t.getTime(), LocalTime.MIDNIGHT);
 480     }
 481 
 482     @Test(groups={"implementation"})
 483     public void test_minusNanos_toMidday() {
 484         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 0, 1)).minusNanos(1);
 485         assertSame(t.getTime(), LocalTime.NOON);
 486     }
 487 
 488     //-----------------------------------------------------------------------
 489     // getDate()
 490     //-----------------------------------------------------------------------
 491     @Test(dataProvider="sampleDates", groups={"implementation"})
 492     public void test_getDate(int year, int month, int day) {
 493         LocalDate d = LocalDate.of(year, month, day);
 494         LocalDateTime dt = LocalDateTime.of(d, LocalTime.MIDNIGHT);
 495         assertSame(dt.getDate(), d);
 496     }
 497 
 498     //-----------------------------------------------------------------------
 499     // getTime()
 500     //-----------------------------------------------------------------------
 501     @Test(dataProvider="sampleTimes", groups={"implementation"})
 502     public void test_getTime(int h, int m, int s, int ns) {
 503         LocalTime t = LocalTime.of(h, m, s, ns);
 504         LocalDateTime dt = LocalDateTime.of(LocalDate.of(2011, 7, 30), t);
 505         assertSame(dt.getTime(), t);
 506     }
 507 
 508     void test_comparisons_LocalDateTime(LocalDate... localDates) {
 509         test_comparisons_LocalDateTime(
 510             localDates,
 511             LocalTime.MIDNIGHT,
 512             LocalTime.of(0, 0, 0, 999999999),
 513             LocalTime.of(0, 0, 59, 0),
 514             LocalTime.of(0, 0, 59, 999999999),
 515             LocalTime.of(0, 59, 0, 0),
 516             LocalTime.of(0, 59, 59, 999999999),
 517             LocalTime.NOON,
 518             LocalTime.of(12, 0, 0, 999999999),
 519             LocalTime.of(12, 0, 59, 0),
 520             LocalTime.of(12, 0, 59, 999999999),
 521             LocalTime.of(12, 59, 0, 0),
 522             LocalTime.of(12, 59, 59, 999999999),
 523             LocalTime.of(23, 0, 0, 0),
 524             LocalTime.of(23, 0, 0, 999999999),
 525             LocalTime.of(23, 0, 59, 0),




 107             {0, 0, 1, 0},
 108             {0, 0, 1, 1},
 109             {0, 1, 0, 0},
 110             {0, 1, 0, 1},
 111             {0, 1, 1, 0},
 112             {0, 1, 1, 1},
 113             {1, 0, 0, 0},
 114             {1, 0, 0, 1},
 115             {1, 0, 1, 0},
 116             {1, 0, 1, 1},
 117             {1, 1, 0, 0},
 118             {1, 1, 0, 1},
 119             {1, 1, 1, 0},
 120             {1, 1, 1, 1},
 121         };
 122     }
 123 
 124     @Test(groups={"implementation"})
 125     public void test_withYear_int_noChange() {
 126         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withYear(2007);
 127         assertSame(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate());
 128         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 129     }
 130 
 131     @Test(groups={"implementation"})
 132     public void test_withMonth_int_noChange() {
 133         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonth(7);
 134         assertSame(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate());
 135         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 136     }
 137 
 138     @Test(groups={"implementation"})
 139     public void test_withDayOfMonth_noChange() {
 140         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withDayOfMonth(15);
 141         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 142     }
 143 
 144     @Test(groups={"implementation"})
 145     public void test_withDayOfYear_noChange() {
 146         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withDayOfYear(31 + 28 + 31 + 30 + 31 + 30 + 15);
 147         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 148     }
 149 
 150     @Test(groups={"implementation"})
 151     public void test_withHour_noChange() {
 152         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withHour(12);
 153         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 154     }
 155 
 156     @Test(groups={"implementation"})
 157     public void test_withHour_toMidnight() {
 158         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).withHour(0);
 159         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 160     }
 161 
 162     @Test(groups={"implementation"})
 163     public void test_withHour_toMidday() {
 164         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).withHour(12);
 165         assertSame(t.toLocalTime(), LocalTime.NOON);
 166     }
 167 
 168     @Test(groups={"implementation"})
 169     public void test_withMinute_noChange() {
 170         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMinute(30);
 171         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 172     }
 173 
 174     @Test(groups={"implementation"})
 175     public void test_withMinute_toMidnight() {
 176         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 1)).withMinute(0);
 177         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 178     }
 179 
 180     @Test(groups={"implementation"})
 181     public void test_withMinute_toMidday() {
 182         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 1)).withMinute(0);
 183         assertSame(t.toLocalTime(), LocalTime.NOON);
 184     }
 185 
 186     @Test(groups={"implementation"})
 187     public void test_withSecond_noChange() {
 188         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withSecond(40);
 189         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 190     }
 191 
 192     @Test(groups={"implementation"})
 193     public void test_withSecond_toMidnight() {
 194         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 1)).withSecond(0);
 195         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 196     }
 197 
 198     @Test(groups={"implementation"})
 199     public void test_withSecond_toMidday() {
 200         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 1)).withSecond(0);
 201         assertSame(t.toLocalTime(), LocalTime.NOON);
 202     }
 203 
 204     @Test(groups={"implementation"})
 205     public void test_withNanoOfSecond_noChange() {
 206         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withNano(987654321);
 207         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 208     }
 209 
 210     @Test(groups={"implementation"})
 211     public void test_withNanoOfSecond_toMidnight() {
 212         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 0, 1)).withNano(0);
 213         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 214     }
 215 
 216     @Test(groups={"implementation"})
 217     public void test_withNanoOfSecond_toMidday() {
 218         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 0, 1)).withNano(0);
 219         assertSame(t.toLocalTime(), LocalTime.NOON);
 220     }
 221 
 222     @Test(groups={"implementation"})
 223     public void test_plus_adjuster_zero() {
 224         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(Period.ZERO);
 225         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 226     }
 227 
 228     @Test(groups={"implementation"})
 229     public void test_plus_Period_zero() {
 230         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(MockSimplePeriod.ZERO_DAYS);
 231         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 232     }
 233 
 234     @Test(groups={"implementation"})
 235     public void test_plus_longPeriodUnit_zero() {
 236         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(0, ChronoUnit.DAYS);
 237         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 238     }
 239 


 253     public void test_plusWeeks_noChange() {
 254         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusWeeks(0);
 255         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 256     }
 257 
 258     @Test(groups={"implementation"})
 259     public void test_plusDays_noChange() {
 260         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusDays(0);
 261         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 262     }
 263 
 264     @Test(groups={"implementation"})
 265     public void test_plusHours_noChange() {
 266         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusHours(0);
 267         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 268     }
 269 
 270     @Test(groups={"implementation"})
 271     public void test_plusHours_toMidnight() {
 272         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 0)).plusHours(1);
 273         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 274     }
 275 
 276     @Test(groups={"implementation"})
 277     public void test_plusHours_toMidday() {
 278         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 0)).plusHours(1);
 279         assertSame(t.toLocalTime(), LocalTime.NOON);
 280     }
 281 
 282     @Test(groups={"implementation"})
 283     public void test_plusMinutes_noChange() {
 284         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusMinutes(0);
 285         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 286     }
 287 
 288     @Test(groups={"implementation"})
 289     public void test_plusMinutes_noChange_oneDay_same() {
 290         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusMinutes(24 * 60);
 291         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 292     }
 293 
 294     @Test(groups={"implementation"})
 295     public void test_plusMinutes_toMidnight() {
 296         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59)).plusMinutes(1);
 297         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 298     }
 299 
 300     @Test(groups={"implementation"})
 301     public void test_plusMinutes_toMidday() {
 302         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59)).plusMinutes(1);
 303         assertSame(t.toLocalTime(), LocalTime.NOON);
 304     }
 305 
 306     @Test(groups={"implementation"})
 307     public void test_plusSeconds_noChange() {
 308         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusSeconds(0);
 309         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 310     }
 311 
 312     @Test(groups={"implementation"})
 313     public void test_plusSeconds_noChange_oneDay_same() {
 314         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusSeconds(24 * 60 * 60);
 315         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 316     }
 317 
 318     @Test(groups={"implementation"})
 319     public void test_plusSeconds_toMidnight() {
 320         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59, 59)).plusSeconds(1);
 321         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 322     }
 323 
 324     @Test(groups={"implementation"})
 325     public void test_plusSeconds_toMidday() {
 326         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59, 59)).plusSeconds(1);
 327         assertSame(t.toLocalTime(), LocalTime.NOON);
 328     }
 329 
 330     @Test(groups={"implementation"})
 331     public void test_plusNanos_noChange() {
 332         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusNanos(0);
 333         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 334     }
 335 
 336     @Test(groups={"implementation"})
 337     public void test_plusNanos_noChange_oneDay_same() {
 338         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusNanos(24 * 60 * 60 * 1000000000L);
 339         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 340     }
 341 
 342     @Test(groups={"implementation"})
 343     public void test_plusNanos_toMidnight() {
 344         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(23, 59, 59, 999999999)).plusNanos(1);
 345         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 346     }
 347 
 348     @Test(groups={"implementation"})
 349     public void test_plusNanos_toMidday() {
 350         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(11, 59, 59, 999999999)).plusNanos(1);
 351         assertSame(t.toLocalTime(), LocalTime.NOON);
 352     }
 353 
 354     @Test(groups={"implementation"})
 355     public void test_minus_adjuster_zero() {
 356         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(Period.ZERO);
 357         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 358     }
 359 
 360     @Test(groups={"implementation"})
 361     public void test_minus_Period_zero() {
 362         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(MockSimplePeriod.ZERO_DAYS);
 363         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 364     }
 365 
 366     @Test(groups={"implementation"})
 367     public void test_minus_longPeriodUnit_zero() {
 368         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(0, ChronoUnit.DAYS);
 369         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 370     }
 371 


 385     public void test_minusWeeks_noChange() {
 386         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusWeeks(0);
 387         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 388     }
 389 
 390     @Test(groups={"implementation"})
 391     public void test_minusDays_noChange() {
 392         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusDays(0);
 393         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 394     }
 395 
 396     @Test(groups={"implementation"})
 397     public void test_minusHours_noChange() {
 398         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusHours(0);
 399         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 400     }
 401 
 402     @Test(groups={"implementation"})
 403     public void test_minusHours_toMidnight() {
 404         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)).minusHours(1);
 405         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 406     }
 407 
 408     @Test(groups={"implementation"})
 409     public void test_minusHours_toMidday() {
 410         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(13, 0)).minusHours(1);
 411         assertSame(t.toLocalTime(), LocalTime.NOON);
 412     }
 413 
 414     @Test(groups={"implementation"})
 415     public void test_minusMinutes_noChange() {
 416         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusMinutes(0);
 417         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 418     }
 419 
 420     @Test(groups={"implementation"})
 421     public void test_minusMinutes_noChange_oneDay_same() {
 422         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusMinutes(24 * 60);
 423         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 424     }
 425 
 426     @Test(groups={"implementation"})
 427     public void test_minusMinutes_toMidnight() {
 428         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 1)).minusMinutes(1);
 429         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 430     }
 431 
 432     @Test(groups={"implementation"})
 433     public void test_minusMinutes_toMidday() {
 434         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 1)).minusMinutes(1);
 435         assertSame(t.toLocalTime(), LocalTime.NOON);
 436     }
 437 
 438     @Test(groups={"implementation"})
 439     public void test_minusSeconds_noChange() {
 440         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusSeconds(0);
 441         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 442     }
 443 
 444     @Test(groups={"implementation"})
 445     public void test_minusSeconds_noChange_oneDay() {
 446         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusSeconds(24 * 60 * 60);
 447         assertEquals(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate().minusDays(1));
 448         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 449     }
 450 
 451     @Test(groups={"implementation"})
 452     public void test_minusSeconds_toMidnight() {
 453         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 1)).minusSeconds(1);
 454         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 455     }
 456 
 457     @Test(groups={"implementation"})
 458     public void test_minusSeconds_toMidday() {
 459         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 1)).minusSeconds(1);
 460         assertSame(t.toLocalTime(), LocalTime.NOON);
 461     }
 462 
 463     @Test(groups={"implementation"})
 464     public void test_minusNanos_noChange() {
 465         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusNanos(0);
 466         assertSame(t, TEST_2007_07_15_12_30_40_987654321);
 467     }
 468 
 469     @Test(groups={"implementation"})
 470     public void test_minusNanos_noChange_oneDay() {
 471         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusNanos(24 * 60 * 60 * 1000000000L);
 472         assertEquals(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate().minusDays(1));
 473         assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime());
 474     }
 475 
 476     @Test(groups={"implementation"})
 477     public void test_minusNanos_toMidnight() {
 478         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 0, 1)).minusNanos(1);
 479         assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
 480     }
 481 
 482     @Test(groups={"implementation"})
 483     public void test_minusNanos_toMidday() {
 484         LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 0, 1)).minusNanos(1);
 485         assertSame(t.toLocalTime(), LocalTime.NOON);
 486     }
 487 
 488     //-----------------------------------------------------------------------
 489     // toLocalDate()
 490     //-----------------------------------------------------------------------
 491     @Test(dataProvider="sampleDates", groups={"implementation"})
 492     public void test_getDate(int year, int month, int day) {
 493         LocalDate d = LocalDate.of(year, month, day);
 494         LocalDateTime dt = LocalDateTime.of(d, LocalTime.MIDNIGHT);
 495         assertSame(dt.toLocalDate(), d);
 496     }
 497 
 498     //-----------------------------------------------------------------------
 499     // toLocalTime()
 500     //-----------------------------------------------------------------------
 501     @Test(dataProvider="sampleTimes", groups={"implementation"})
 502     public void test_getTime(int h, int m, int s, int ns) {
 503         LocalTime t = LocalTime.of(h, m, s, ns);
 504         LocalDateTime dt = LocalDateTime.of(LocalDate.of(2011, 7, 30), t);
 505         assertSame(dt.toLocalTime(), t);
 506     }
 507 
 508     void test_comparisons_LocalDateTime(LocalDate... localDates) {
 509         test_comparisons_LocalDateTime(
 510             localDates,
 511             LocalTime.MIDNIGHT,
 512             LocalTime.of(0, 0, 0, 999999999),
 513             LocalTime.of(0, 0, 59, 0),
 514             LocalTime.of(0, 0, 59, 999999999),
 515             LocalTime.of(0, 59, 0, 0),
 516             LocalTime.of(0, 59, 59, 999999999),
 517             LocalTime.NOON,
 518             LocalTime.of(12, 0, 0, 999999999),
 519             LocalTime.of(12, 0, 59, 0),
 520             LocalTime.of(12, 0, 59, 999999999),
 521             LocalTime.of(12, 59, 0, 0),
 522             LocalTime.of(12, 59, 59, 999999999),
 523             LocalTime.of(23, 0, 0, 0),
 524             LocalTime.of(23, 0, 0, 999999999),
 525             LocalTime.of(23, 0, 59, 0),