@Test public void newStringTest() { final StringMakerFactory stringMaker = DefaultStringMakerFactory.getInstance(); StringMaker newString = stringMaker.newString(); Assert.assertEquals(newString.getClass(), StringBuilderImpl.class); newString = newString.append(true); Assert.assertEquals("true", newString.toString()); newString = newString.append(false); Assert.assertEquals("truefalse", newString.toString()); newString = newString.append('e'); Assert.assertEquals("truefalsee", newString.toString()); final char[] chararray = { 'a', 'r', 'h', 'j' }; newString = newString.append(chararray); Assert.assertEquals("truefalseearhj", newString.toString()); newString = newString.append(25.4); Assert.assertEquals("truefalseearhj25.4", newString.toString()); newString = newString.append(47f); Assert.assertEquals("truefalseearhj25.447.0", newString.toString()); newString = newString.append(624551); Assert.assertEquals("truefalseearhj25.447.0624551", newString.toString()); newString = newString.append(new Byte("10")); Assert.assertEquals("truefalseearhj25.447.062455110", newString.toString()); newString = newString.append("string"); Assert.assertEquals("truefalseearhj25.447.062455110string", newString.toString()); newString = newString.append(new StringBuffer("buffer")); Assert.assertEquals("truefalseearhj25.447.062455110stringbuffer", newString.toString()); newString = newString.append(chararray, 2, 2); Assert.assertEquals("truefalseearhj25.447.062455110stringbufferhj", newString.toString()); newString = newString.replace(6, 14, "re"); Assert.assertEquals("truefare25.447.062455110stringbufferhj", newString.toString()); final String substring = newString.substring(20, 35); Assert.assertEquals("5110stringbuffe", substring); newString = newString.delete(16, 20); Assert.assertEquals("truefare25.447.05110stringbufferhj", newString.toString()); Assert.assertEquals(34, newString.length()); }
public StringMaker newString() { return delegate.newString(); }
DefaultStringMakerFactory implements StringMakerFactory { public StringMaker newString() { return delegate.newString(); } }
DefaultStringMakerFactory implements StringMakerFactory { public StringMaker newString() { return delegate.newString(); } private  DefaultStringMakerFactory(); }
DefaultStringMakerFactory implements StringMakerFactory { public StringMaker newString() { return delegate.newString(); } private  DefaultStringMakerFactory(); static StringMakerFactory getInstance(); StringMaker newString(); StringMaker newString(final int capacity); StringMaker newString(final String str); int getPriority(); }
DefaultStringMakerFactory implements StringMakerFactory { public StringMaker newString() { return delegate.newString(); } private  DefaultStringMakerFactory(); static StringMakerFactory getInstance(); StringMaker newString(); StringMaker newString(final int capacity); StringMaker newString(final String str); int getPriority();  }