use of org.joda.time.YearMonth in project serenity-jbehave by serenity-bdd.
the class WhenConvertingJodaDateTimes method should_detect_YearMonth_format_with_slash.
@Test
public void should_detect_YearMonth_format_with_slash() {
YearMonthConverter converter = new YearMonthConverter();
YearMonth convertedTime = (YearMonth) converter.convertValue("10/1942", YearMonth.class);
assertThat(convertedTime.getMonthOfYear()).isEqualTo(10);
assertThat(convertedTime.getYear()).isEqualTo(1942);
}
use of org.joda.time.YearMonth in project joda-time-android by dlew.
the class TestDateUtils method testIsToday.
public void testIsToday() {
LocalDate today = LocalDate.now();
LocalDate yesterday = today.minusDays(1);
LocalDate tomorrow = today.plusDays(1);
assertEquals(true, DateUtils.isToday(today));
assertEquals(false, DateUtils.isToday(yesterday));
assertEquals(false, DateUtils.isToday(tomorrow));
LocalDateTime todayLdt = LocalDateTime.now();
LocalDateTime yesterdayLdt = todayLdt.minusDays(1);
LocalDateTime tomorrowLdt = todayLdt.plusDays(1);
assertEquals(true, DateUtils.isToday(todayLdt));
assertEquals(false, DateUtils.isToday(yesterdayLdt));
assertEquals(false, DateUtils.isToday(tomorrowLdt));
DateTime todayDt = DateTime.now();
DateTime yesterdayDt = todayDt.minusDays(1);
DateTime tomorrowDt = todayDt.plusDays(1);
assertEquals(true, DateUtils.isToday(todayDt));
assertEquals(false, DateUtils.isToday(yesterdayDt));
assertEquals(false, DateUtils.isToday(tomorrowDt));
try {
DateUtils.isToday(new MonthDay());
fail("DateUtils.isToday() should have thrown an error since MonthDay has no year.");
} catch (Exception e) {
}
try {
DateUtils.isToday(new YearMonth());
fail("DateUtils.isToday() should have thrown an error since YearMonth has no day.");
} catch (Exception e) {
}
}
use of org.joda.time.YearMonth in project serenity-jbehave by serenity-bdd.
the class WhenConvertingJodaDateTimes method should_detect_YearMonth_format.
@Test
public void should_detect_YearMonth_format() {
YearMonthConverter converter = new YearMonthConverter();
YearMonth convertedTime = (YearMonth) converter.convertValue("10-1942", YearMonth.class);
assertThat(convertedTime.getMonthOfYear()).isEqualTo(10);
assertThat(convertedTime.getYear()).isEqualTo(1942);
}
use of org.joda.time.YearMonth in project serenity-jbehave by serenity-bdd.
the class WhenConvertingJodaDateTimes method should_detect_MonthYear_format_with_slash.
@Test
public void should_detect_MonthYear_format_with_slash() {
YearMonthConverter converter = new YearMonthConverter();
YearMonth convertedTime = (YearMonth) converter.convertValue("1942/10", YearMonth.class);
assertThat(convertedTime.getMonthOfYear()).isEqualTo(10);
assertThat(convertedTime.getYear()).isEqualTo(1942);
}
use of org.joda.time.YearMonth in project serenity-jbehave by serenity-bdd.
the class WhenConvertingJodaDateTimes method should_detect_MonthYear_format.
@Test
public void should_detect_MonthYear_format() {
YearMonthConverter converter = new YearMonthConverter();
YearMonth convertedTime = (YearMonth) converter.convertValue("1942-10", YearMonth.class);
assertThat(convertedTime.getMonthOfYear()).isEqualTo(10);
assertThat(convertedTime.getYear()).isEqualTo(1942);
}
Aggregations