\r
public class JU_HTML4GenTest {\r
\r
- private final static String DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""\r
- + " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";\r
+ private final static String DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""\r
+ + " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";\r
\r
- private String charset = "utf-8";\r
+ private String charset = "utf-8";\r
\r
- private final String CHARSET_LINE = "<meta http-equiv=\"Content-type\" content=\"text.hml; charset=" + charset\r
- + "\">";\r
+ private final String CHARSET_LINE = "<meta http-equiv=\"Content-type\" content=\"text.hml; charset=" + charset\r
+ + "\">";\r
\r
- @Mock\r
- Writer w;\r
+ @Mock\r
+ Writer w;\r
\r
- @Before\r
- public void setUp() throws Exception {\r
+ @Before\r
+ public void setUp() throws Exception {\r
\r
- w = mock(Writer.class);\r
- }\r
+ w = mock(Writer.class);\r
+ }\r
\r
- @Test\r
- public void testHTML() throws IOException {\r
+ @Test\r
+ public void testHTML() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.html("attributes");\r
+ gen.html("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
- for (char ch : DOCTYPE.toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ Map<Character, Integer> map = new TreeMap<>();\r
+ for (char ch : DOCTYPE.toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "html".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "html".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- verify(w, atLeast(1)).write(anyInt());\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ verify(w, atLeast(1)).write(anyInt());\r
+ }\r
\r
- @Test\r
- public void testHead() throws IOException {\r
+ @Test\r
+ public void testHead() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.head();\r
+ gen.head();\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "head".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "head".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testBody() throws IOException {\r
+ @Test\r
+ public void testBody() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.body("attributes");\r
+ gen.body("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "body".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "body".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testCharSet() throws IOException {\r
+ @Test\r
+ public void testCharSet() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.charset(charset);\r
+ gen.charset(charset);\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : CHARSET_LINE.toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : CHARSET_LINE.toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testHeader() throws IOException {\r
+ @Test\r
+ public void testHeader() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.header("attributes");\r
+ gen.header("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "header".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "header".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testFooter() throws IOException {\r
+ @Test\r
+ public void testFooter() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.footer("attributes");\r
+ gen.footer("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "footer".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "footer".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testSection() throws IOException {\r
+ @Test\r
+ public void testSection() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.section("attributes");\r
+ gen.section("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "section".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "section".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testArticle() throws IOException {\r
+ @Test\r
+ public void testArticle() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.article("attributes");\r
+ gen.article("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "attrib".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attrib".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testAside() throws IOException {\r
+ @Test\r
+ public void testAside() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.aside("attributes");\r
+ gen.aside("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "aside".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "aside".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
- @Test\r
- public void testNav() throws IOException {\r
+ @Test\r
+ public void testNav() throws IOException {\r
\r
- HTML4Gen gen = new HTML4Gen(w);\r
+ HTML4Gen gen = new HTML4Gen(w);\r
\r
- gen.nav("attributes");\r
+ gen.nav("attributes");\r
\r
- Map<Character, Integer> map = new TreeMap<Character, Integer>();\r
+ Map<Character, Integer> map = new TreeMap<>();\r
\r
- for (char ch : "nav".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "nav".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "div".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "div".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : "attributes".toCharArray()) {\r
- Integer times = map.get(ch);\r
- map.put(ch, (times == null ? 0 : times) + 1);\r
- }\r
+ for (char ch : "attributes".toCharArray()) {\r
+ Integer times = map.get(ch);\r
+ map.put(ch, (times == null ? 0 : times) + 1);\r
+ }\r
\r
- for (char ch : map.keySet()) {\r
- verify(w, atLeast(map.get(ch))).write(ch);\r
- }\r
- }\r
+ for (char ch : map.keySet()) {\r
+ verify(w, atLeast(map.get(ch))).write(ch);\r
+ }\r
+ }\r
\r
}\r