PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/razpub/test_src/com/razie/pub/draw/test/TestStreams.java

http://razpub.googlecode.com/
Java | 32 lines | 21 code | 7 blank | 4 comment | 0 complexity | c36342d9f69b3280eea0e08570f39d1e MD5 | raw file
 1/**
 2 * Razvan's public code. 
 3 * Copyright 2008 based on Apache license (share alike) see LICENSE.txt for details.
 4 */
 5package com.razie.pub.draw.test;
 6
 7import java.io.ByteArrayOutputStream;
 8import java.io.IOException;
 9
10import junit.framework.TestCase;
11import razie.draw.HttpDrawStream;
12import razie.draw.JsonDrawStream;
13
14import com.razie.pub.base.log.Log;
15
16public class TestStreams extends TestCase {
17
18    public void setUp() {
19    }
20
21    public void testAllStreams() throws IOException {
22        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
23        HttpDrawStream http = new HttpDrawStream (bytes);
24        http.write("11");
25        assertTrue (bytes.toString().contains("HTTP"));
26        JsonDrawStream json = new JsonDrawStream (bytes);
27        json.write("11");
28        assertTrue (bytes.toString().contains("/json"));
29    }
30
31    static final Log logger = Log.factory.create(TestStreams.class.getName());
32}