//------------------------------------------------------------------------- public virtual void test_of_combined() { HolidayCalendar test = HolidayCalendars.of("Thu/Fri+Fri/Sat"); assertEquals(test.Name, "Fri/Sat+Thu/Fri"); assertEquals(test.ToString(), "HolidayCalendar[Fri/Sat+Thu/Fri]"); HolidayCalendar test2 = HolidayCalendars.of("Thu/Fri+Fri/Sat"); assertEquals(test, test2); }
//------------------------------------------------------------------------- public virtual void test_defaulting() { ReferenceData @base = ImmutableReferenceData.of(ImmutableMap.of(HolidayCalendarIds.FRI_SAT, HolidayCalendars.FRI_SAT)); ReferenceData test = HolidayCalendars.defaultingReferenceData(@base); assertEquals(test.getValue(HolidayCalendarIds.FRI_SAT), HolidayCalendars.FRI_SAT); assertEquals(test.getValue(HolidayCalendarIds.GBLO), DEFAULTED_GBLO); assertEquals(test.containsValue(HolidayCalendarIds.FRI_SAT), true); assertEquals(test.containsValue(HolidayCalendarIds.GBLO), true); assertEquals(test.containsValue(new TestingReferenceDataId("1")), false); }
//------------------------------------------------------------------------- public override DayCount lookup(string name) { DayCount value = BY_NAME.get(name); if (value == null) { if (name.regionMatches(true, 0, "Bus/252 ", 0, 8)) { HolidayCalendar cal = HolidayCalendars.of(name.Substring(8)); // load from standard calendars string correctName = "Bus/252 " + cal.Name; DayCount created = new Bus252(correctName, cal); value = BY_NAME.computeIfAbsent(correctName, k => created); BY_NAME.putIfAbsent(correctName.ToUpper(Locale.ENGLISH), created); } } return(value); }
public virtual void test_defaulting_combinedWith() { ReferenceData base1 = ImmutableReferenceData.of(ImmutableMap.of(HolidayCalendarIds.THU_FRI, HolidayCalendars.THU_FRI)); ReferenceData base2 = ImmutableReferenceData.of(ImmutableMap.of(HolidayCalendarIds.THU_FRI, HolidayCalendars.FRI_SAT, HolidayCalendarIds.FRI_SAT, HolidayCalendars.FRI_SAT)); ReferenceData testDefaulted = HolidayCalendars.defaultingReferenceData(base1); assertEquals(testDefaulted.getValue(HolidayCalendarIds.THU_FRI), HolidayCalendars.THU_FRI); assertEquals(testDefaulted.getValue(HolidayCalendarIds.FRI_SAT), DEFAULTED_FRI_SAT); assertEquals(testDefaulted.getValue(HolidayCalendarIds.GBLO), DEFAULTED_GBLO); ReferenceData testCombined = testDefaulted.combinedWith(base2); assertEquals(testCombined.getValue(HolidayCalendarIds.THU_FRI), HolidayCalendars.THU_FRI); // test1 takes precedence assertEquals(testCombined.getValue(HolidayCalendarIds.FRI_SAT), HolidayCalendars.FRI_SAT); // from test2 assertEquals(testCombined.getValue(HolidayCalendarIds.GBLO), DEFAULTED_GBLO); // from default ReferenceData testCombinedRevered = base2.combinedWith(testDefaulted); assertEquals(testCombinedRevered.getValue(HolidayCalendarIds.THU_FRI), HolidayCalendars.FRI_SAT); // test2 takes precedence assertEquals(testCombinedRevered.getValue(HolidayCalendarIds.FRI_SAT), HolidayCalendars.FRI_SAT); // from test2 assertEquals(testCombinedRevered.getValue(HolidayCalendarIds.GBLO), DEFAULTED_GBLO); // from default }
//------------------------------------------------------------------------- public virtual void test_extendedEnum() { assertEquals(HolidayCalendars.extendedEnum().lookupAll().get("NoHolidays"), HolidayCalendars.NO_HOLIDAYS); }
public virtual void test_NO_HOLIDAYS_of() { HolidayCalendar test = HolidayCalendars.of("NoHolidays"); assertEquals(test, HolidayCalendars.NO_HOLIDAYS); }
public virtual void test_THU_FRI_of() { HolidayCalendar test = HolidayCalendars.of("Thu/Fri"); assertEquals(test, HolidayCalendars.THU_FRI); }
public virtual void test_FRI_SAT_of() { HolidayCalendar test = HolidayCalendars.of("Fri/Sat"); assertEquals(test, HolidayCalendars.FRI_SAT); }
public virtual void test_SAT_SUN_of() { HolidayCalendar test = HolidayCalendars.of("Sat/Sun"); assertEquals(test, HolidayCalendars.SAT_SUN); }
public virtual void test_jodaBeans_serialize() { serialize(HolidayCalendars.NO_HOLIDAYS); serialize(HolidayCalendars.SAT_SUN); serialize(HolidayCalendars.of("GBLO")); }