Search in sources :

Example 31 with LocalDate

use of java.time.LocalDate in project jdk8u_jdk by JetBrains.

the class TCKJulianFields method test_samples_parse_STRICT.

//-----------------------------------------------------------------------
@Test(dataProvider = "samples")
public void test_samples_parse_STRICT(TemporalField field, LocalDate date, long value) {
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.STRICT);
    LocalDate parsed = LocalDate.parse(Long.toString(value), f);
    assertEquals(parsed, date);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) LocalDate(java.time.LocalDate) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 32 with LocalDate

use of java.time.LocalDate in project jdk8u_jdk by JetBrains.

the class TCKJulianFields method test_samples_parse_SMART.

@Test(dataProvider = "samples")
public void test_samples_parse_SMART(TemporalField field, LocalDate date, long value) {
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.SMART);
    LocalDate parsed = LocalDate.parse(Long.toString(value), f);
    assertEquals(parsed, date);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) LocalDate(java.time.LocalDate) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 33 with LocalDate

use of java.time.LocalDate in project jdk8u_jdk by JetBrains.

the class TCKJulianFields method test_samples_parse_LENIENT.

@Test(dataProvider = "samples")
public void test_samples_parse_LENIENT(TemporalField field, LocalDate date, long value) {
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withResolverStyle(ResolverStyle.LENIENT);
    LocalDate parsed = LocalDate.parse(Long.toString(value), f);
    assertEquals(parsed, date);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) LocalDate(java.time.LocalDate) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 34 with LocalDate

use of java.time.LocalDate in project jdk8u_jdk by JetBrains.

the class TCKIsoFields method test_parse_quarters_LENIENT.

@Test(dataProvider = "quarter")
public void test_parse_quarters_LENIENT(LocalDate date, int doq, int qoy) {
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(YEAR).appendLiteral('-').appendValue(IsoFields.QUARTER_OF_YEAR).appendLiteral('-').appendValue(IsoFields.DAY_OF_QUARTER).toFormatter().withResolverStyle(ResolverStyle.LENIENT);
    LocalDate parsed = LocalDate.parse(date.getYear() + "-" + qoy + "-" + doq, f);
    assertEquals(parsed, date);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) LocalDate(java.time.LocalDate) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test)

Example 35 with LocalDate

use of java.time.LocalDate in project jdk8u_jdk by JetBrains.

the class TCKIsoFields method test_parse_parseLenientQuarter_LENIENT.

@Test(dataProvider = "parseLenientQuarter")
public void test_parse_parseLenientQuarter_LENIENT(String str, LocalDate expected, boolean smart) {
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(YEAR).appendLiteral(':').appendValue(IsoFields.QUARTER_OF_YEAR).appendLiteral(':').appendValue(IsoFields.DAY_OF_QUARTER).toFormatter().withResolverStyle(ResolverStyle.LENIENT);
    LocalDate parsed = LocalDate.parse(str, f);
    assertEquals(parsed, expected);
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) LocalDate(java.time.LocalDate) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test)

Aggregations

LocalDate (java.time.LocalDate)1513 Test (org.junit.Test)472 Test (org.testng.annotations.Test)372 LocalDateTime (java.time.LocalDateTime)155 LocalTime (java.time.LocalTime)126 Date (java.util.Date)99 DateTimeFormatter (java.time.format.DateTimeFormatter)96 Ignore (org.junit.Ignore)94 ArrayList (java.util.ArrayList)87 BigDecimal (java.math.BigDecimal)69 Instant (java.time.Instant)56 ZonedDateTime (java.time.ZonedDateTime)55 Test (org.junit.jupiter.api.Test)54 List (java.util.List)50 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)46 HashMap (java.util.HashMap)44 Member (cz.metacentrum.perun.core.api.Member)41 ZoneId (java.time.ZoneId)40 TemporalField (java.time.temporal.TemporalField)40 Attribute (cz.metacentrum.perun.core.api.Attribute)39