コード例 #1
0
 @BeforeMethod(groups = {"tck"})
 public void setUp() {
   printEmptyContext =
       new DateTimePrintContext(EMPTY, Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   ZonedDateTime zdt =
       LocalDateTime.of(2011, 6, 30, 12, 30, 40, 0).atZone(ZoneId.of("Europe/Paris"));
   printContext = new DateTimePrintContext(zdt, Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   parseContext = new DateTimeParseContext(Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   buf = new StringBuilder();
 }
コード例 #2
0
 // -----------------------------------------------------------------------
 // Test Serialization of ISO via chrono API
 // -----------------------------------------------------------------------
 @Test(
     groups = {"tck"},
     dataProvider = "calendars")
 public <C extends Chrono<C>> void test_ChronoZonedDateTimeSerialization(C chrono)
     throws Exception {
   ZonedDateTime ref = LocalDate.of(2000, 1, 5).atTime(12, 1, 2, 3).atZone(ZoneId.of("GMT+01:23"));
   ChronoZonedDateTime<C> orginal = chrono.date(ref).atTime(ref.getTime()).atZone(ref.getZone());
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   ObjectOutputStream out = new ObjectOutputStream(baos);
   out.writeObject(orginal);
   out.close();
   ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
   ObjectInputStream in = new ObjectInputStream(bais);
   ChronoZonedDateTime<C> ser = (ChronoZonedDateTime<C>) in.readObject();
   assertEquals(ser, orginal, "deserialized date is wrong");
 }