PageRenderTime 35ms CodeModel.GetById 13ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 1ms

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

http://razpub.googlecode.com/
Java | 92 lines | 77 code | 11 blank | 4 comment | 0 complexity | 41c81fec2b49b3d41fcb2e169dc92b57 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.IOException;
 8
 9import junit.framework.TestCase;
10import razie.draw.DrawList;
11import razie.draw.DrawStream;
12import razie.draw.DrawTable;
13import razie.draw.SimpleDrawStream;
14import razie.draw.Technology;
15
16import com.razie.pub.base.log.Log;
17
18public class TestContainers extends TestCase {
19
20    public void setUp() {
21    }
22
23    public void testWriteList() throws IOException {
24        DrawStream stream = new SimpleDrawStream(Technology.HTML);
25        DrawList list = new DrawList();
26        list.write("11");
27        list.write("22");
28        list.write("33");
29        stream.write(list);
30        String s = stream.toString();
31        assertTrue(s.contains("33"));
32    }
33
34    public void testWriteTable() throws IOException {
35        DrawStream stream = new SimpleDrawStream(Technology.HTML);
36        DrawTable list = new DrawTable(0, 2);
37        list.write("11");
38        list.write("22");
39        list.write("33");
40        stream.write(list);
41        String s = stream.toString();
42        assertTrue(s.contains("33"));
43    }
44
45    public void testStreamList() throws IOException {
46        DrawStream stream = new SimpleDrawStream(Technology.HTML);
47        DrawList list = new DrawList();
48        stream.open(list);
49        String s = stream.toString();
50        list.write("11");
51        list.write("22");
52        list.write("33");
53        s = stream.toString();
54        assertTrue(s.contains("33"));
55        list.close();
56        s = stream.toString();
57        assertTrue(s.contains("33"));
58    }
59
60    public void testStreamTable() throws IOException {
61        DrawStream stream = new SimpleDrawStream(Technology.HTML);
62        DrawTable list = new DrawTable(0, 2);
63        stream.open(list);
64        String s = stream.toString();
65        list.write("11");
66        list.write("22");
67        list.write("33");
68        s = stream.toString();
69        assertFalse(s.contains("33"));
70        list.close();
71        s = stream.toString();
72        assertTrue(s.contains("33"));
73    }
74
75    public void testStreamTableWithExactCols() throws IOException {
76        DrawStream stream = new SimpleDrawStream(Technology.HTML);
77        DrawTable list = new DrawTable(0, 2);
78        stream.open(list);
79        String s = stream.toString();
80        list.write("11");
81        list.write("22");
82        list.write("33");
83        list.write("44");
84        s = stream.toString();
85        assertFalse(s.contains("33"));
86        list.close();
87        s = stream.toString();
88        assertTrue(s.contains("33"));
89    }
90
91    static final Log logger = Log.factory.create(TestContainers.class.getName());
92}