Java Code Examples for java.time.chrono.ChronoZonedDateTime#plus()
The following examples show how to use
java.time.chrono.ChronoZonedDateTime#plus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKChronoZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 2
Source File: TCKChronoZonedDateTime.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 3
Source File: TCKChronoZonedDateTime.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 4
Source File: TCKChronoZonedDateTime.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 5
Source File: TCKChronoZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 6
Source File: TCKChronoZonedDateTime.java From hottub with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 7
Source File: TCKChronoZonedDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 8
Source File: TCKChronoZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 9
Source File: TCKChronoZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 10
Source File: TCKChronoZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 11
Source File: TCKChronoZonedDateTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 12
Source File: TCKChronoZonedDateTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 13
Source File: TCKChronoZonedDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 14
Source File: TCKChronoZonedDateTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date time"); } } }
Example 15
Source File: TCKChronoZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 16
Source File: TCKChronoZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 17
Source File: TCKChronoZonedDateTime.java From j2objc with Apache License 2.0 | 6 votes |
@Test() @UseDataProvider("data_of_calendars") public void test_badPlusAdjusterChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : (Chronology[][]) data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalAmount adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.plus(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(adjuster); assertEquals("WithAdjuster failed to replace date time", result, czdt2); } } }
Example 18
Source File: TCKChronoZonedDateTime.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 19
Source File: TCKChronoZonedDateTime.java From j2objc with Apache License 2.0 | 6 votes |
@Test() @UseDataProvider("data_of_calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : (Chronology[][]) data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals("WithAdjuster failed to replace date", result, czdt2); } } }
Example 20
Source File: TCKChronoZonedDateTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badPlusTemporalUnitChrono(Chronology chrono) { LocalDate refDate = LocalDate.of(2013, 1, 1); ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); for (Chronology[] clist : data_of_calendars()) { Chronology chrono2 = clist[0]; ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC); TemporalUnit adjuster = new FixedTemporalUnit(czdt2); if (chrono != chrono2) { try { czdt.plus(1, adjuster); Assert.fail("TemporalUnit.doPlus plus should have thrown a ClassCastException, " + czdt + " can not be cast to " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.plus(1, adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }