1 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 ; 32 import java.util.Arrays ; 33 import java.util.Collection ; 34 35 import org.snipsnap.render.macro.list.ExampleListFormatter; 36 37 public class ExampleListFormatterTest extends ListFormatterSupport { 38 public ExampleListFormatterTest(String 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 { 47 super.setUp(); 48 formatter = new ExampleListFormatter(); 49 } 50 51 public void testSize() { 52 Collection c = Arrays.asList(new String []{"test"}); 53 try { 54 formatter.format(writer, emptyLinkable, "", c, "", true); 55 } catch (IOException 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 c = Arrays.asList(new String []{"test"}); 65 try { 66 formatter.format(writer, emptyLinkable, "", c, "", false); 67 } catch (IOException 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 |