1   /*
2    * ByteToInputStreamConverterTest.java
3    *
4    * Created on 17 Май 2006 г., 11:46
5    */
6   
7   package org.weda.converter;
8   
9   import java.io.InputStream;
10  import java.util.Arrays;
11  import junit.framework.TestCase;
12  import org.apache.commons.io.IOUtils;
13  import org.weda.converter.impl.ByteToInputStreamConverter;
14  
15  /**
16   *
17   * @author Mikhail Titov
18   */
19  public class ByteToInputStreamConverterTest extends TestCase {
20      
21      public ByteToInputStreamConverterTest(String name){
22          super(name);
23      }
24      
25      public void test() throws Exception {       
26          ByteToInputStreamConverter conv = new ByteToInputStreamConverter();
27          checkConverter(conv);
28      }
29      
30      public void checkConverter(ValueTypeConverter conv) 
31          throws Exception
32      {
33          byte[] arr = new byte[]{1,2,3,4};
34          InputStream ins = 
35                  (InputStream)conv.convert(InputStream.class, arr, null);
36          byte[] resArr = IOUtils.toByteArray(ins);
37          assertTrue(Arrays.equals(arr, resArr));
38      }
39  }