本文整理汇总了Java中java.time.chrono.JapaneseDate.of方法的典型用法代码示例。如果您正苦于以下问题:Java JapaneseDate.of方法的具体用法?Java JapaneseDate.of怎么用?Java JapaneseDate.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.chrono.JapaneseDate
的用法示例。
在下文中一共展示了JapaneseDate.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test3
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test3() throws NoSuchMethodException, SecurityException, SQLException {
PropertyMapperManager mapper = new PropertyMapperManager();
LocalDate localDate = LocalDate.now();
java.sql.Date date = java.sql.Date.valueOf(localDate);
JapaneseDate japaneseDate = JapaneseDate.of(localDate.getYear(), localDate.getMonthValue(), localDate.getDayOfMonth());
assertThat(mapper.getValue(JavaType.of(JapaneseEra.class), newResultSet("getInt", 2), 1), is(JapaneseEra.HEISEI));
assertThat(mapper.getValue(JavaType.of(Era.class), newResultSet("getInt", 2), 1), is(nullValue()));
assertThat(mapper.getValue(JavaType.of(JapaneseDate.class), newResultSet("getDate", date), 1), is(japaneseDate));
assertThat(mapper.getValue(JavaType.of(ChronoLocalDate.class), newResultSet("getDate", null), 1), is(nullValue()));
assertThat(mapper.getValue(JavaType.of(JapaneseEra.class), newResultSet("getInt", 0, "wasNull", true), 1), is(nullValue()));
assertThat(mapper.getValue(JavaType.of(JapaneseDate.class), newResultSet("getDate", null), 1), is(nullValue()));
}
示例2: data_zonedDateTime
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@DataProvider(name="zonedDateTime")
Object[][] data_zonedDateTime() {
return new Object[][] {
{ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
{OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
{LocalDateTime.of(2012, 2, 29, 2, 7), null, null, DateTimeException.class},
{JapaneseDate.of(2012, 2, 29), null, null, DateTimeException.class},
{ThaiBuddhistDate.of(2012 + 543, 2, 29), null, null, DateTimeException.class},
{LocalDate.of(2012, 2, 29), null, null, DateTimeException.class},
{LocalTime.of(20, 30, 29, 0), null, null, DateTimeException.class},
};
}
示例3: data_localDateTime
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@DataProvider(name="localDateTime")
Object[][] data_localDateTime() {
return new Object[][] {
{LocalDateTime.of(2012, 2, 29, 2, 7), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7), null},
{ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
{OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
{JapaneseDate.of(2012, 2, 29), null, null, DateTimeException.class},
{ThaiBuddhistDate.of(2012 + 543, 2, 29), null, null, DateTimeException.class},
{LocalDate.of(2012, 2, 29), null, null, DateTimeException.class},
{LocalTime.of(20, 30, 29, 0), null, null, DateTimeException.class},
};
}
示例4: test_createYd
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByProleptic")
public void test_createYd(int y, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.dateYearDay(y, doy);
JapaneseDate dateByDateFactory = JapaneseDate.of(y, moy, dom);
assertEquals(dateByChronoFactory, dateByDateFactory);
assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
}
示例5: test_createYmd
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByProleptic")
public void test_createYmd(int y, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.date(y, moy, dom);
JapaneseDate dateByDateFactory = JapaneseDate.of(y, moy, dom);
assertEquals(dateByChronoFactory, dateByDateFactory);
assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
}
示例6: data_localDateTime
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@DataProvider(name="localDateTime")
Object[][] data_localDateTime() {
return new Object[][] {
{LocalDateTime.of(2012, 2, 29, 2, 7), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29), LocalTime.of(2, 7), null},
{ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_PARIS), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29), LocalTime.of(2, 7, 1, 1), null},
{OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29), LocalTime.of(2, 7, 1, 1), null},
{JapaneseDate.of(2012, 2, 29), null, null, DateTimeException.class},
{ThaiBuddhistDate.of(2012 + 543, 2, 29), null, null, DateTimeException.class},
{LocalDate.of(2012, 2, 29), null, null, DateTimeException.class},
{LocalTime.of(20, 30, 29, 0), null, null, DateTimeException.class},
};
}
示例7: data_of_calendars
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@DataProvider(name = "calendars")
Object[][] data_of_calendars() {
return new Object[][]{
{JapaneseDate.of(JapaneseEra.HEISEI, 25, 01, 05), JAPANESE_DATE_TYPE},
{MinguoDate.of(102, 01, 05), MINGUO_DATE_TYPE},
{ThaiBuddhistDate.of(2556, 01, 05), THAIBUDDHIST_DATE_TYPE},
};
}
示例8: test_periodUntilDiffChrono
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_periodUntilDiffChrono() {
JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
ChronoPeriod period = mdate1.until(ldate2);
assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
}
示例9: test_createByEra_chronologyTemporalFactory
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByEra")
public void test_createByEra_chronologyTemporalFactory(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
assertEquals(IsoChronology.INSTANCE.date(test), iso);
assertEquals(JapaneseChronology.INSTANCE.date(iso), test);
}
示例10: test_createByEra_dateFrom
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByEra")
public void test_createByEra_dateFrom(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
assertEquals(LocalDate.from(test), iso);
assertEquals(JapaneseDate.from(iso), test);
}
示例11: test_createByEra_query
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByEra")
public void test_createByEra_query(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
assertEquals(test.query(TemporalQueries.localDate()), iso);
}
示例12: test_createByEra_epochDay
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByEra")
public void test_createByEra_epochDay(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
assertEquals(test.getLong(EPOCH_DAY), iso.getLong(EPOCH_DAY));
assertEquals(test.toEpochDay(), iso.toEpochDay());
}
示例13: test_createByProleptic_chronologyTemporalFactory
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByProleptic")
public void test_createByProleptic_chronologyTemporalFactory(int y, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(y, moy, dom);
assertEquals(IsoChronology.INSTANCE.date(test), iso);
assertEquals(JapaneseChronology.INSTANCE.date(iso), test);
}
示例14: test_createByProleptic_isEqual
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByProleptic")
public void test_createByProleptic_isEqual(int y, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(y, moy, dom);
assertEquals(test.isEqual(iso), true);
assertEquals(iso.isEqual(test), true);
}
示例15: test_createByProleptic_dateFrom
import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(dataProvider="createByProleptic")
public void test_createByProleptic_dateFrom(int y, int moy, int dom, int doy, LocalDate iso) {
JapaneseDate test = JapaneseDate.of(y, moy, dom);
assertEquals(LocalDate.from(test), iso);
assertEquals(JapaneseDate.from(iso), test);
}