下面列出了java.time.chrono.MinguoDate#now ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@DataProvider(name="parseChronoLocalDate")
Object[][] provider_chronoLocalDate() {
return new Object[][] {
{ HijrahDate.now() },
{ JapaneseDate.now() },
{ MinguoDate.now() },
{ ThaiBuddhistDate.now() }};
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
MinguoDate minguo = MinguoDate.now();
minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
if (isLeapYear) {
assertEquals(minguo.lengthOfMonth(), 29);
} else {
assertEquals(minguo.lengthOfMonth(), 28);
}
}