@Test(expected = UnsupportedEncodingException.class) public void exceptions_in_close() throws IOException { final OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream()) { @Override public void close() throws IOException { throw new UnsupportedEncodingException("Bah"); } }; final ProxyWriter proxy = new ProxyWriter(osw); proxy.close(); } }
@Test public void nullCharSequencec() throws Exception { final ProxyWriter proxy = new ProxyWriter(new NullWriter()); proxy.append(null); proxy.close(); }
@Test public void writeCharArray() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.write(new char[]{'A', 'B', 'C'}); assertEquals("ABC", writer.toString()); proxy.close(); }
@Test public void writeString() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.write("ABC"); assertEquals("ABC", writer.toString()); proxy.close(); }
@Test public void writeStringPartial() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.write("ABC", 1, 2); assertEquals("BC", writer.toString()); proxy.close(); }
@Test public void appendChar() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.append('c'); assertEquals("c", writer.toString()); proxy.close(); }
@Test public void nullCharArray() throws Exception { final ProxyWriter proxy = new ProxyWriter(new NullWriter()); proxy.write((char[]) null); proxy.write((char[]) null, 0, 0); proxy.close(); }
@Test public void writeInt() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.write(65); assertEquals("A", writer.toString()); proxy.close(); }
@Test public void appendCharSequence() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.append("ABC"); assertEquals("ABC", writer.toString()); proxy.close(); }
@Test public void writeCharArrayPartial() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.write(new char[]{'A', 'B', 'C'}, 1, 2); assertEquals("BC", writer.toString()); proxy.close(); }
@Test public void nullString() throws Exception { final ProxyWriter proxy = new ProxyWriter(new NullWriter()); proxy.write((String) null); proxy.write((String) null, 0, 0); proxy.close(); }
@Test public void appendCharSequence_with_offset() throws Exception { final StringBuilderWriter writer = new StringBuilderWriter(); final ProxyWriter proxy = new ProxyWriter(writer); proxy.append("ABC", 1, 3); proxy.flush(); assertEquals("BC", writer.toString()); proxy.close(); }
public void close() throws IOException { closed = true; super.close(); }
public void close() throws IOException { closed = true; super.close(); }
@Override public void close() throws IOException { super.close(); if (count > 0) { logger.warn( "Ignored {} chars written to PrintWriter by {}, turn on DEBUG logging to see the output", count, portletWindow); } }
@Override public void close() throws IOException { super.close(); if (count > 0) { logger.warn( "Ignored {} chars written to PrintWriter by {}, turn on DEBUG logging to see the output", count, portletWindow); } }
@Override public void close() throws IOException { try { super.close(); } finally { branch.close(); } }
@Override public void close() throws IOException { try { super.close(); } finally { branch.close(); } }