本文整理汇总了Java中java.time.chrono.MinguoChronology类的典型用法代码示例。如果您正苦于以下问题:Java MinguoChronology类的具体用法?Java MinguoChronology怎么用?Java MinguoChronology使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MinguoChronology类属于java.time.chrono包,在下文中一共展示了MinguoChronology类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: provider_reducedWithChrono
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@DataProvider(name="ReducedWithChrono")
Object[][] provider_reducedWithChrono() {
LocalDate baseYear = LocalDate.of(2000, 1, 1);
return new Object[][] {
{IsoChronology.INSTANCE.date(baseYear)},
{IsoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{IsoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{HijrahChronology.INSTANCE.date(baseYear)},
{HijrahChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{HijrahChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{JapaneseChronology.INSTANCE.date(baseYear)},
{JapaneseChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{JapaneseChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{MinguoChronology.INSTANCE.date(baseYear)},
{MinguoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{MinguoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
};
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:TestReducedParser.java
示例2: test_dateNow
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_dateNow(){
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoDate.now()) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoDate.now(ZoneId.systemDefault())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoDate.now(Clock.systemDefaultZone())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoDate.now(Clock.systemDefaultZone().getZone())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoChronology.INSTANCE.dateNow(ZoneId.systemDefault())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoChronology.INSTANCE.dateNow(Clock.systemDefaultZone())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(), MinguoChronology.INSTANCE.dateNow(Clock.systemDefaultZone().getZone())) ;
ZoneId zoneId = ZoneId.of("Europe/Paris");
assertEquals(MinguoChronology.INSTANCE.dateNow(zoneId), MinguoChronology.INSTANCE.dateNow(Clock.system(zoneId))) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(zoneId), MinguoChronology.INSTANCE.dateNow(Clock.system(zoneId).getZone())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(zoneId), MinguoDate.now(Clock.system(zoneId))) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(zoneId), MinguoDate.now(Clock.system(zoneId).getZone())) ;
assertEquals(MinguoChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), MinguoChronology.INSTANCE.dateNow(Clock.systemUTC())) ;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:TCKMinguoChronology.java
示例3: test_resolve_yearOfEra
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_yearOfEra")
public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
if (e != null) {
fieldValues.put(ChronoField.ERA, (long) e);
}
if (yoe != null) {
fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
}
if (y != null) {
fieldValues.put(ChronoField.YEAR, (long) y);
}
if (field != null) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, style);
assertEquals(date, null);
assertEquals(fieldValues.get(field), (Long) expected.longValue());
assertEquals(fieldValues.size(), 1);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, style);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:TCKMinguoChronology.java
示例4: test_resolve_ymd_strict
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_ymd")
public void test_resolve_ymd_strict(int y, int m, int d, MinguoDate expected, Object smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
if (strict) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:TCKMinguoChronology.java
示例5: test_resolve_yd_smart
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_yd")
public void test_resolve_yd_smart(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
if (smart) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TCKMinguoChronology.java
示例6: test_resolve_yd_strict
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_yd")
public void test_resolve_yd_strict(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
if (strict) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TCKMinguoChronology.java
示例7: test_resolve_ymaa_smart
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_ymaa")
public void test_resolve_ymaa_smart(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
if (smart) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:TCKMinguoChronology.java
示例8: test_resolve_ymaa_strict
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_ymaa")
public void test_resolve_ymaa_strict(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.YEAR, (long) y);
fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
if (strict) {
MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
assertEquals(date, expected);
assertEquals(fieldValues.size(), 0);
} else {
try {
MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
fail("Should have failed");
} catch (DateTimeException ex) {
// expected
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:TCKMinguoChronology.java
示例9: data_epochSecond
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@DataProvider(name = "epochSecond_dataProvider")
Object[][] data_epochSecond() {
return new Object[][] {
{JapaneseChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{JapaneseChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{JapaneseChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{HijrahChronology.INSTANCE, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{MinguoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{ThaiBuddhistChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
};
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TCKChronology.java
示例10: data_era_epochSecond
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@DataProvider(name = "era_epochSecond_dataProvider")
Object[][] data_era_epochSecond() {
return new Object[][] {
{JapaneseChronology.INSTANCE, JapaneseEra.MEIJI, 1873 - YDIFF_MEIJI, 9, 7, 1, 2, 2, OFFSET_P0100},
{JapaneseChronology.INSTANCE, JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 2, 28, 1, 2, 2, OFFSET_M0100},
{JapaneseChronology.INSTANCE, JapaneseEra.HEISEI, 1989 - YDIFF_HEISEI, 1, 8, 1, 2, 2, OFFSET_P0100},
{HijrahChronology.INSTANCE, HijrahEra.AH, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, MinguoEra.BEFORE_ROC, 1873 - YDIFF_MINGUO, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, MinguoEra.ROC, 1928 - YDIFF_MINGUO, 2, 28, 1, 2, 2, OFFSET_M0100},
{MinguoChronology.INSTANCE, MinguoEra.ROC, 1989 - YDIFF_MINGUO, 1, 8, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1873 + YDIFF_THAIBUDDHIST, 9, 7, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1928 + YDIFF_THAIBUDDHIST, 2, 28, 1, 2, 2, OFFSET_M0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1989 + YDIFF_THAIBUDDHIST, 1, 8, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
};
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TCKChronology.java
示例11: test_withChronology_override
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_withChronology_override() {
DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
assertEquals(accessor.query(TemporalQueries.localTime()), null);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKDateTimeParseResolver.java
示例12: test_withChronology_parsedChronology_override
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_withChronology_parsedChronology_override() {
DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendChronologyId().toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("ThaiBuddhist");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
assertEquals(accessor.query(TemporalQueries.localTime()), null);
assertEquals(accessor.query(TemporalQueries.chronology()), ThaiBuddhistChronology.INSTANCE);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKDateTimeParseResolver.java
示例13: test_fieldResolvesToChronoLocalDate_overrideChrono_matches
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_fieldResolvesToChronoLocalDate_overrideChrono_matches() {
MinguoDate mdt = MinguoDate.of(100, 6, 30);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
assertEquals(accessor.query(TemporalQueries.localTime()), null);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKDateTimeParseResolver.java
示例14: data_of_calendars
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@DataProvider(name = "calendars")
Chronology[][] data_of_calendars() {
return new Chronology[][]{
{HijrahChronology.INSTANCE},
{IsoChronology.INSTANCE},
{JapaneseChronology.INSTANCE},
{MinguoChronology.INSTANCE},
{ThaiBuddhistChronology.INSTANCE}};
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:TCKChronoLocalDateTimeSerialization.java
示例15: test_fieldResolvesToChronoLocalDateTime_overrideChrono_matches
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_fieldResolvesToChronoLocalDateTime_overrideChrono_matches() {
MinguoDate mdt = MinguoDate.of(100, 6, 30);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt.atTime(LocalTime.NOON))).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKDateTimeParseResolver.java
示例16: test_fieldResolvesToChronoLocalDateTime_overrideChrono_wrongChrono
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoLocalDateTime_overrideChrono_wrongChrono() {
ChronoLocalDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
f.parse("1234567890");
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKDateTimeParseResolver.java
示例17: test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches() {
MinguoDate mdt = MinguoDate.of(100, 6, 30);
ChronoZonedDateTime<MinguoDate> mzdt = mdt.atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mzdt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
TemporalAccessor accessor = f.parse("1234567890");
assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TCKDateTimeParseResolver.java
示例18: test_fieldResolvesToChronoZonedDateTime_overrideChrono_wrongChrono
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test(expectedExceptions = DateTimeParseException.class)
public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_wrongChrono() {
ChronoZonedDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
f = f.withChronology(MinguoChronology.INSTANCE);
f.parse("1234567890");
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKDateTimeParseResolver.java
示例19: data_CalendarType
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@DataProvider(name = "calendarsystemtype")
Object[][] data_CalendarType() {
return new Object[][] {
{HijrahChronology.INSTANCE, "islamic-umalqura"},
{IsoChronology.INSTANCE, "iso8601"},
{JapaneseChronology.INSTANCE, "japanese"},
{MinguoChronology.INSTANCE, "roc"},
{ThaiBuddhistChronology.INSTANCE, "buddhist"},
};
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKChronology.java
示例20: test_MinguoChronology_dateNow
import java.time.chrono.MinguoChronology; //导入依赖的package包/类
@Test
public void test_MinguoChronology_dateNow() {
ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
Clock clock = Clock.system(zoneId_paris);
Chronology chrono = Chronology.of("Minguo");
assertEquals(chrono.dateNow(), MinguoChronology.INSTANCE.dateNow());
assertEquals(chrono.dateNow(zoneId_paris), MinguoChronology.INSTANCE.dateNow(zoneId_paris));
assertEquals(chrono.dateNow(clock), MinguoChronology.INSTANCE.dateNow(clock));
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKChronology.java
注:本文中的java.time.chrono.MinguoChronology类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论