use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_minus_long_TemporalUnit.
@Test(dataProvider = "minus_long_TemporalUnit")
public void test_minus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class<?> expectedEx) {
if (expectedEx == null) {
assertEquals(base.minus(amount, unit), expectedYearMonth);
} else {
try {
YearMonth result = base.minus(amount, unit);
fail();
} catch (Exception ex) {
assertTrue(expectedEx.isInstance(ex));
}
}
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYearMonth method test_withYear_int_noChange_equal.
@Test
public void test_withYear_int_noChange_equal() {
YearMonth test = YearMonth.of(2008, 6);
assertEquals(test.withYear(2008), test);
}
use of java.time.YearMonth in project jdk8u_jdk by JetBrains.
the class TCKYear method test_until_convertedType.
@Test
public void test_until_convertedType() {
Year start = Year.of(2010);
YearMonth end = start.plusYears(2).atMonth(Month.APRIL);
assertEquals(start.until(end, YEARS), 2);
}
use of java.time.YearMonth in project JFoenix by jfoenixadmin.
the class JFXDatePickerContent method updateMonthYearPane.
protected void updateMonthYearPane() {
// update date labels
YearMonth yearMonth = selectedYearMonth.get();
if (datePicker.getValue() != null)
selectedDateLabel.setText(DateTimeFormatter.ofPattern("EEE, MMM yy").format(datePicker.getValue()));
else
selectedDateLabel.setText(DateTimeFormatter.ofPattern("EEE, MMM yy").format(LocalDate.now()));
selectedYearLabel.setText(formatYear(yearMonth));
monthYearLabel.setText(formatMonth(yearMonth) + " " + formatYear(yearMonth));
Chronology chrono = datePicker.getChronology();
LocalDate firstDayOfMonth = yearMonth.atDay(1);
backMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, -1, DAYS));
forwardMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, +1, MONTHS));
}
use of java.time.YearMonth in project wildfly by wildfly.
the class YearMonthExternalizer method readObject.
@Override
public YearMonth readObject(ObjectInput input) throws IOException, ClassNotFoundException {
int year = input.readInt();
Month month = MonthExternalizer.INSTANCE.readObject(input);
return YearMonth.of(year, month);
}
Aggregations