Beispiel #1
0
 /**
  * Test method for {@link com.googlecode.socofo.common.impl.IOHelperImpl#read(java.io.InputStream,
  * byte[])} .
  */
 @Test
 public final void testRead() {
   final byte[] buffer = new byte[5000];
   final BufferedInputStream bis =
       new BufferedInputStream(getClass().getResourceAsStream("/buffertest.txt"));
   final int read = to.read(bis, buffer);
   Assert.assertTrue(read > 0);
   to.closeInputstream(bis);
   String str = to.createString(buffer, "utf-8");
   Assert.assertNotNull(str);
   str = str.trim();
   Assert.assertEquals("test", str);
 }
Beispiel #2
0
 /**
  * Test method for {@link com.googlecode.socofo.common.impl.IOHelperImpl#createString(byte[],
  * java.lang.String)} .
  */
 @Test
 public final void testCreateString() {
   final String s = "test";
   byte[] b = null;
   try {
     b = s.getBytes("utf-8");
   } catch (final UnsupportedEncodingException e) {
     Assert.fail(e.getLocalizedMessage());
   }
   final String s2 = to.createString(b, "utf-8");
   Assert.assertEquals(s, s2);
 }
Beispiel #3
0
 /**
  * Test method for {@link
  * com.googlecode.socofo.common.impl.IOHelperImpl#closeOutputstream(java.io.OutputStream)} .
  */
 @Test
 public final void testCloseOutputstream() {
   to.closeOutputstream(null);
 }
Beispiel #4
0
 /**
  * Test method for {@link
  * com.googlecode.socofo.common.impl.IOHelperImpl#closeReader(java.io.Reader)} .
  */
 @Test
 public final void testCloseReader() {
   to.closeReader(null);
 }