예제 #1
0
  @Test
  public void factoryIncorrectNameOfFormatter() {
    thrown.expectMessage("Can't create instance of blahblah");

    StringFormatterFactory f = new StringFormatterFactory();
    StringFormatter a = (StringFormatter) f.create("blahblah");
  }
예제 #2
0
 @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);
 }
예제 #3
0
  @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));
  }
예제 #4
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);
 }