forked from svendiedrichsen/jollyday
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request svendiedrichsen#39 from MoriTanosuke/master
Add method to create ManagerParameter from Locale
- Loading branch information
Showing
2 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/java/de/jollyday/parameter/ManagerParametersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package de.jollyday.parameter; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import de.jollyday.HolidayManager; | ||
import de.jollyday.ManagerParameter; | ||
import de.jollyday.ManagerParameters; | ||
import java.util.Calendar; | ||
import java.util.Locale; | ||
import org.junit.Test; | ||
|
||
public class ManagerParametersTest { | ||
@Test | ||
public void testCreateParameterFromLocale() { | ||
ManagerParameter params = ManagerParameters.create(Locale.GERMANY); | ||
HolidayManager manager = HolidayManager.getInstance(params); | ||
assertEquals(Locale.GERMANY.getCountry().toLowerCase(), manager.getCalendarHierarchy().getId()); | ||
Calendar thirdOfOctober = Calendar.getInstance(); | ||
thirdOfOctober.set(Calendar.MONTH, Calendar.OCTOBER); | ||
thirdOfOctober.set(Calendar.DAY_OF_MONTH, 3); | ||
assertTrue("Oct 3rd should be a holiday in " + Locale.GERMANY, manager.isHoliday(thirdOfOctober)); | ||
} | ||
} |