@Test public void should_return_preferred_instance() { final DividendYieldCalculator common = dividendYieldCalculatorFactory.newInstance(StockType.PREFERRED); assertNotNull(common); assertEquals(DividendYieldPreferredCalculatorImpl.class, common.getClass()); assertNotEquals(DividendYieldCommonCalculatorImpl.class, common.getClass()); }
@Test(expected = NullPointerException.class) public void should_throw_null_pointer_exception() { dividendYieldCalculatorFactory.newInstance(null); }