StubCalculator { public static StubType getStartStubType(final LocalDate[] schedule, final int paymentsPerYear) { return getStartStubType(schedule, paymentsPerYear, false); } private  StubCalculator(); static StubType getStartStubType(final LocalDate[] schedule, final int paymentsPerYear); static StubType getStartStubType(final LocalDate[] schedule, final double paymentsPerYear, final boolean isEndOfMonthConvention); static StubType getEndStubType(final LocalDate[] schedule, final int paymentsPerYear); static StubType getEndStubType(final LocalDate[] schedule, final double paymentsPerYear, final boolean isEndOfMonthConvention);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullSchedule1() { StubCalculator.getStartStubType((LocalDate[]) null, 1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInSchedule1() { StubCalculator.getStartStubType(new LocalDate[] {null, null}, 1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativePayments2() { StubCalculator.getStartStubType(NO_STUB2, -1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBadPayments2() { StubCalculator.getStartStubType(NO_STUB2, 5); }
@Test public void testStartType() { assertEquals(StubCalculator.getStartStubType(NO_STUB2, 4), StubType.NONE); assertEquals(StubCalculator.getStartStubType(SHORT_START_STUB2, 4), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(LONG_START_STUB2, 4), StubType.LONG_START); assertEquals(StubCalculator.getStartStubType(SHORT_END_STUB2, 4), StubType.NONE); assertEquals(StubCalculator.getStartStubType(LONG_END_STUB2, 4), StubType.NONE); assertEquals(StubCalculator.getStartStubType(NO_STUB4, 4), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(SHORT_START_STUB4, 4), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(LONG_START_STUB4, 4), StubType.LONG_START); assertEquals(StubCalculator.getStartStubType(SHORT_END_STUB4, 4), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(LONG_END_STUB4, 4), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(NO_STUB4, 4, true), StubType.NONE); assertEquals(StubCalculator.getStartStubType(SHORT_START_STUB4, 4, true), StubType.SHORT_START); assertEquals(StubCalculator.getStartStubType(LONG_START_STUB4, 4, true), StubType.LONG_START); assertEquals(StubCalculator.getStartStubType(SHORT_END_STUB4, 4, true), StubType.NONE); assertEquals(StubCalculator.getStartStubType(LONG_END_STUB4, 4, true), StubType.NONE); }