SimpleFrequencyFactory extends AbstractNamedInstanceFactory<SimpleFrequency> { @Deprecated public SimpleFrequency getFrequency(final String name) { try { return instance(name); } catch (IllegalArgumentException ex) { return null; } } private  SimpleFrequencyFactory(); @FromString static SimpleFrequency of(final String name); @Deprecated SimpleFrequency getFrequency(final String name); SimpleFrequency getFrequency(final int periods); @Deprecated Iterator<SimpleFrequency> enumerateAvailableFrequencies(); static final SimpleFrequencyFactory INSTANCE; }
@Test public void getFrequencyByPeriodCount() { assertEquals(SimpleFrequency.DAILY, _factory.getFrequency(365)); assertEquals(SimpleFrequency.WEEKLY, _factory.getFrequency(52)); assertEquals(SimpleFrequency.BIWEEKLY, _factory.getFrequency(26)); assertEquals(SimpleFrequency.TWENTY_EIGHT_DAYS, _factory.getFrequency(13)); assertEquals(SimpleFrequency.MONTHLY, _factory.getFrequency(12)); assertEquals(SimpleFrequency.BIMONTHLY, _factory.getFrequency(6)); assertEquals(SimpleFrequency.QUARTERLY, _factory.getFrequency(4)); assertEquals(SimpleFrequency.SEMI_ANNUAL, _factory.getFrequency(2)); assertEquals(SimpleFrequency.ANNUAL, _factory.getFrequency(1)); }