01: package liquibase.util;
02:
03: import static junit.framework.Assert.assertEquals;
04: import org.junit.Test;
05:
06: import java.io.ByteArrayInputStream;
07: import java.io.IOException;
08: import java.io.StringReader;
09:
10: public class StreamUtilTest {
11:
12: @Test
13: public void testGetStreamContents() throws IOException {
14: byte[] contents = "TEST2".getBytes();
15: ByteArrayInputStream stream = new ByteArrayInputStream(contents);
16: String result = StreamUtil.getStreamContents(stream);
17: assertEquals("TEST2", result);
18: }
19:
20: @Test
21: public void testGetReaderContents() throws IOException {
22: String contents = "TEST";
23: StringReader reader = new StringReader(contents);
24: String result = StreamUtil.getReaderContents(reader);
25: assertEquals(contents, result);
26: }
27:
28: }
|