Search in sources :

Example 56 with DateTimeFormatter

use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method factory_parse_formatter_nullText.

@Test(expectedExceptions = NullPointerException.class)
public void factory_parse_formatter_nullText() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("M d");
    MonthDay.parse((String) null, f);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 57 with DateTimeFormatter

use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.

the class TCKYearMonth method factory_parse_formatter_nullText.

@Test(expectedExceptions = NullPointerException.class)
public void factory_parse_formatter_nullText() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("y M");
    YearMonth.parse((String) null, f);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 58 with DateTimeFormatter

use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.

the class TCKYearMonth method test_format_formatter.

//-----------------------------------------------------------------------
// format(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void test_format_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("y M");
    String t = YearMonth.of(2010, 12).format(f);
    assertEquals(t, "2010 12");
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 59 with DateTimeFormatter

use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.

the class TCKYearMonth method factory_parse_formatter.

//-----------------------------------------------------------------------
// parse(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void factory_parse_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("y M");
    YearMonth test = YearMonth.parse("2010 12", f);
    assertEquals(test, YearMonth.of(2010, 12));
}
Also used : YearMonth(java.time.YearMonth) DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 60 with DateTimeFormatter

use of java.time.format.DateTimeFormatter in project jdk8u_jdk by JetBrains.

the class TCKDateTimeFormatter method test_print_TemporalAppendable_nullAppendable.

@Test(expectedExceptions = NullPointerException.class)
public void test_print_TemporalAppendable_nullAppendable() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    test.formatTo(LocalDate.of(2008, 6, 30), (Appendable) null);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Aggregations

DateTimeFormatter (java.time.format.DateTimeFormatter)905 Test (org.junit.Test)297 Test (org.testng.annotations.Test)272 DateTimeFormatterBuilder (java.time.format.DateTimeFormatterBuilder)229 TemporalAccessor (java.time.temporal.TemporalAccessor)205 LocalDate (java.time.LocalDate)142 ParsePosition (java.text.ParsePosition)94 LocalDateTime (java.time.LocalDateTime)92 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)85 ZonedDateTime (java.time.ZonedDateTime)71 Instant (java.time.Instant)53 DateTimeParseException (java.time.format.DateTimeParseException)50 ZoneId (java.time.ZoneId)39 TemporalField (java.time.temporal.TemporalField)39 WeekFields (java.time.temporal.WeekFields)36 AbstractTCKTest (tck.java.time.AbstractTCKTest)36 DateTimeException (java.time.DateTimeException)34 IOException (java.io.IOException)26 Format (java.text.Format)26 LocalTime (java.time.LocalTime)25