01: /*
02: * This file is part of "SnipSnap Radeox Rendering Engine".
03: *
04: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
05: * All Rights Reserved.
06: *
07: * Please visit http://radeox.org/ for updates and contact.
08: *
09: * --LICENSE NOTICE--
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: * --LICENSE NOTICE--
22: */
23: package org.radeox.test.macro.list;
24:
25: import java.io.IOException;
26: import java.util.Arrays;
27: import java.util.Collection;
28:
29: import junit.framework.Test;
30: import junit.framework.TestSuite;
31:
32: import org.radeox.macro.list.ExampleListFormatter;
33:
34: public class ExampleListFormatterTest extends ListFormatterSupport {
35: public ExampleListFormatterTest(String name) {
36: super (name);
37: }
38:
39: public static Test suite() {
40: return new TestSuite(ExampleListFormatterTest.class);
41: }
42:
43: protected void setUp() throws Exception {
44: super .setUp();
45: formatter = new ExampleListFormatter();
46: }
47:
48: public void testSize() {
49: Collection c = Arrays.asList(new String[] { "test" });
50: try {
51: formatter.format(writer, emptyLinkable, "", c, "", true);
52: } catch (IOException e) {
53: e.printStackTrace();
54: }
55: assertEquals(
56: "Size is rendered",
57: "<div class=\"list\"><div class=\"list-title\"> (1)</div><ol><li>test</li></ol></div>",
58: writer.toString());
59: }
60:
61: public void testSingeItem() {
62: Collection c = Arrays.asList(new String[] { "test" });
63: try {
64: formatter.format(writer, emptyLinkable, "", c, "", false);
65: } catch (IOException e) {
66: e.printStackTrace();
67: }
68: assertEquals(
69: "Single item is rendered",
70: "<div class=\"list\"><div class=\"list-title\"></div><ol><li>test</li></ol></div>",
71: writer.toString());
72: }
73: }
|