Java Code Examples for java.time.chrono.ChronoZonedDateTime#with()
The following examples show how to use
java.time.chrono.ChronoZonedDateTime#with() .
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 j2objc with Apache License 2.0 | 6 votes |
@Test() @UseDataProvider("data_of_calendars") public void test_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals("WithAdjuster failed to replace date", result, czdt2); } } }
Example 2
Source File: TCKChronoZonedDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() 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_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 4
Source File: TCKChronoZonedDateTime.java From j2objc with Apache License 2.0 | 6 votes |
@Test() @UseDataProvider("data_of_calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals("TemporalField doWith() failed to replace date", result, czdt2); } } }
Example 5
Source File: TCKChronoZonedDateTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 6
Source File: TCKChronoZonedDateTime.java From hottub with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() 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_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() failed to replace date"); } } }
Example 8
Source File: TCKChronoZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() 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_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 10
Source File: TCKChronoZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() 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_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 12
Source File: TCKChronoZonedDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() 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_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 14
Source File: TCKChronoZonedDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() failed to replace date"); } } }
Example 15
Source File: TCKChronoZonedDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(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_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() failed to replace date"); } } }
Example 17
Source File: TCKChronoZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 18
Source File: TCKChronoZonedDateTime.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() failed to replace date"); } } }
Example 19
Source File: TCKChronoZonedDateTime.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badWithAdjusterChrono(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); TemporalAdjuster adjuster = new FixedAdjuster(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster); Assert.fail("WithAdjuster should have thrown a ClassCastException, " + "required: " + czdt + ", supplied: " + czdt2); } catch (ClassCastException cce) { // Expected exception; not an error } } else { ChronoZonedDateTime<?> result = czdt.with(adjuster); assertEquals(result, czdt2, "WithAdjuster failed to replace date"); } } }
Example 20
Source File: TCKChronoZonedDateTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="calendars") public void test_badTemporalFieldChrono(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); TemporalField adjuster = new FixedTemporalField(czdt2); if (chrono != chrono2) { try { czdt.with(adjuster, 1); Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass() + " can not be cast to " + czdt2.getClass()); } catch (ClassCastException cce) { // Expected exception; not an error } } else { // Same chronology, ChronoZonedDateTime<?> result = czdt.with(adjuster, 1); assertEquals(result, czdt2, "TemporalField doWith() failed to replace date"); } } }