Java Code Examples for java.time.LocalDate#query()

The following examples show how to use java.time.LocalDate#query() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompanyHolidayQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void is_date_a_holiday () {
	
	LocalDate date = LocalDate.of(2014, Month.DECEMBER, 25); // XMAS

	Boolean isHoliday = date.query(new CompanyHolidayQuery());
	
	assertTrue(isHoliday);
}
 
Example 2
Source File: CompanyHolidayQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void is_not_date_a_holiday () {
	
	LocalDate date = LocalDate.of(2014, Month.NOVEMBER, 22);

	Boolean isHoliday = date.query(new CompanyHolidayQuery());
	
	assertFalse(isHoliday);
}
 
Example 3
Source File: WorkDayQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void work_day_query () {
	
	LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 02); // Sunday
	
	Boolean workDay = date.query(new WorkDayQuery());
	
	assertFalse(workDay);
}
 
Example 4
Source File: CurrentQuarterQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void validate_first_quarter () {
	
	LocalDate date = LocalDate.of(2014, Month.MARCH, 4); 

	Integer quarter = date.query(new CurrentQuarterQuery());
	
	assertEquals(new Integer(1), quarter);
}
 
Example 5
Source File: CurrentQuarterQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void validate_second_quarter () {
	
	LocalDate date = LocalDate.of(2014, Month.MAY, 8); 

	Integer quarter = date.query(new CurrentQuarterQuery());
	
	assertEquals(new Integer(2), quarter);
}
 
Example 6
Source File: CurrentQuarterQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void validate_third_quarter () {
	
	LocalDate date = LocalDate.of(2014, Month.SEPTEMBER, 2); 

	Integer quarter = date.query(new CurrentQuarterQuery());
	
	assertEquals(new Integer(3), quarter);
}
 
Example 7
Source File: CurrentQuarterQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void validate_fourth_quarter () {
	
	LocalDate date = LocalDate.of(2014, Month.DECEMBER, 18); 

	Integer quarter = date.query(new CurrentQuarterQuery());
	
	assertEquals(new Integer(4), quarter);
}
 
Example 8
Source File: DaylightSavingQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void during_daylight_savings() {

	LocalDate date = LocalDate.of(2014, Month.JULY, 02);

	Boolean daylightSavings = date.query(new DaylightSavingQuery());

	assertTrue(daylightSavings);
}
 
Example 9
Source File: DaylightSavingQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void not_during_daylight_savings() {

	LocalDate date = LocalDate.of(2014, Month.DECEMBER, 02);

	Boolean daylightSavings = date.query(new DaylightSavingQuery());

	assertTrue(daylightSavings);
}
 
Example 10
Source File: WeekendQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void check_if_date_is_weekend () {
	
	LocalDate date = LocalDate.of(2014, 02, 02); // Sunday
	
	Boolean workDay = date.query(new WeekendQuery());

	assertTrue(workDay);
}
 
Example 11
Source File: MarketDayQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void check_if_random_date_is_market_day() {
	
	LocalDate date = LocalDate.of(2014, 02, 02); // Sunday

	Boolean marketDay = date.query(new MarketDayQuery());

	assertTrue(marketDay);
}
 
Example 12
Source File: HurricaneSeasonQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void is_before_hurricane_season () {

	LocalDate date = LocalDate.of(2014, Month.JANUARY, 02); 

	Boolean isHurricaneSeason = date.query(new HurricaneSeasonQuery());

	assertFalse(isHurricaneSeason);
}
 
Example 13
Source File: HurricaneSeasonQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void is_during_hurricane_season () {

	LocalDate date = LocalDate.of(2014, Month.JUNE, 30); 

	Boolean isHurricaneSeason = date.query(new HurricaneSeasonQuery());

	assertTrue(isHurricaneSeason);
}
 
Example 14
Source File: HurricaneSeasonQuery.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void is_after_hurricane_season () {

	LocalDate date = LocalDate.of(2014, Month.DECEMBER, 30); 

	Boolean isHurricaneSeason = date.query(new HurricaneSeasonQuery());

	assertFalse(isHurricaneSeason);
}
 
Example 15
Source File: CurrentQuarter.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void current_quarter_with_java8() {

	LocalDate date = LocalDate.of(2014, 02, 01);
	
	Integer quarter = date.query(new Quarter());

	assertEquals(new Integer(1), quarter);
}