KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snipsnap > test > render > macro > list > ExampleListFormatterTest


1 /*
2  * This file is part of "SnipSnap Radeox Rendering Engine".
3  *
4  * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
5  * All Rights Reserved.
6  *
7  * Please visit http://radeox.org/ for updates and contact.
8  *
9  * --LICENSE NOTICE--
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  * --LICENSE NOTICE--
24  */

25 package org.snipsnap.test.render.macro.list;
26
27 import junit.framework.Test;
28 import junit.framework.TestSuite;
29
30
31 import java.io.IOException JavaDoc;
32 import java.util.Arrays JavaDoc;
33 import java.util.Collection JavaDoc;
34
35 import org.snipsnap.render.macro.list.ExampleListFormatter;
36
37 public class ExampleListFormatterTest extends ListFormatterSupport {
38   public ExampleListFormatterTest(String JavaDoc name) {
39     super(name);
40   }
41
42   public static Test suite() {
43     return new TestSuite(ExampleListFormatterTest.class);
44   }
45
46   protected void setUp() throws Exception JavaDoc {
47     super.setUp();
48     formatter = new ExampleListFormatter();
49   }
50
51   public void testSize() {
52     Collection JavaDoc c = Arrays.asList(new String JavaDoc[]{"test"});
53     try {
54       formatter.format(writer, emptyLinkable, "", c, "", true);
55     } catch (IOException JavaDoc e) {
56       e.printStackTrace();
57     }
58     assertEquals("Size is rendered",
59         "<div class=\"list\"><div class=\"list-title\"> (1)</div><ol><li>test</li></ol></div>",
60         writer.toString());
61   }
62
63   public void testSingeItem() {
64     Collection JavaDoc c = Arrays.asList(new String JavaDoc[]{"test"});
65     try {
66       formatter.format(writer, emptyLinkable, "", c, "", false);
67     } catch (IOException JavaDoc e) {
68       e.printStackTrace();
69     }
70     assertEquals("Single item is rendered",
71         "<div class=\"list\"><div class=\"list-title\"></div><ol><li>test</li></ol></div>",
72         writer.toString());
73   }
74 }
75
Popular Tags