@Test public void factoryIncorrectNameOfFormatter() { thrown.expectMessage("Can't create instance of blahblah"); StringFormatterFactory f = new StringFormatterFactory(); StringFormatter a = (StringFormatter) f.create("blahblah"); }
@Test public void factoryNullPointerException() { thrown.expectMessage("Name of the extension class can't be null"); StringFormatterFactory f = new StringFormatterFactory(); ru.fizteh.fivt.format.StringFormatter ff = f.create(StringFormatterDoubleExtension.class.getName(), null); }
@Test public void factoryGetFormatterFromHash() { StringFormatterFactory f = new StringFormatterFactory(); StringFormatter a = (StringFormatter) f.create(StringFormatterDoubleExtension.class.getName()); StringFormatter b = (StringFormatter) f.create(StringFormatterDoubleExtension.class.getName()); assertEquals(a.extensions.get(0), b.extensions.get(0)); }
@Test public void factoryNullParamList() { thrown.expectMessage("Extensions list mustn't be null"); StringFormatterFactory f = new StringFormatterFactory(); ru.fizteh.fivt.format.StringFormatter ff = f.create(null); }