From a8e1924175e644a639b9a6bce13c5bd51eca0d39 Mon Sep 17 00:00:00 2001 From: LegitCheetah Date: Thu, 25 Jan 2024 00:58:20 +0100 Subject: [PATCH] html.java SingleModules added and corrections htmlTest.java new tests and corrections --- src/main/html.java | 8 ++++++++ src/test/htmlTest.java | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/main/html.java b/src/main/html.java index ed81635..056a1c6 100644 --- a/src/main/html.java +++ b/src/main/html.java @@ -9,6 +9,10 @@ public class html { return "<"+tag.getTag()+">"+content+"\n"; } + public String htmlSingleModule(htmlTagsEnum tag){ + return "<"+tag.getTag()+">\n"; + } + public String customContentModule(String tag, String content){ return "<"+tag+">\n"+content+"\n\n"; } @@ -16,4 +20,8 @@ public class html { public String customInlineModule(String tag, String content){ return "<"+tag+">"+content+"\n"; } + + public String customSingleModule(String tag){ + return "<"+tag+">\n"; + } } diff --git a/src/test/htmlTest.java b/src/test/htmlTest.java index f118c31..e928bf1 100644 --- a/src/test/htmlTest.java +++ b/src/test/htmlTest.java @@ -12,22 +12,41 @@ class htmlTest { @Test void htmlContentModuleTest() { - assertEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content")); - assertNotEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail")); - assertNotEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.PRETAG,"content")); + assertEquals("\ncontent\n\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content")); + assertNotEquals("\ncontent\n\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail")); + assertNotEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content")); } @Test void htmlInlineModuleTest() { - assertEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content")); - assertNotEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail")); - assertNotEquals("\ncontent\n",html.htmlContentModule(htmlTagsEnum.PRETAG,"content")); + assertEquals("content\n",html.htmlInlineModule(htmlTagsEnum.TESTTAG,"content")); + assertNotEquals("content\n",html.htmlInlineModule(htmlTagsEnum.TESTTAG,"fail")); + assertNotEquals("content",html.htmlInlineModule(htmlTagsEnum.TESTTAG,"content")); + } + + @Test + void htmlSingleModuleTest(){ + assertEquals("testtag>\n", html.htmlSingleModule(htmlTagsEnum.TESTTAG)); + assertNotEquals("testtag", html.htmlSingleModule(htmlTagsEnum.TESTTAG)); } @Test void customContentModuleTest() { - assertEquals("\ncontent\n",html.customContentModule("testtag","content")); - assertNotEquals("\ncontent\n",html.customContentModule("testtag","fail")); - assertNotEquals("\ncontent\n",html.customContentModule("pretag","content")); + assertEquals("\ncontent\n\n",html.customContentModule("testtag","content")); + assertNotEquals("\ncontent\n\n",html.customContentModule("testtag","fail")); + assertNotEquals("\ncontent\n",html.customContentModule("testtag","content")); + } + + @Test + void customInlineModuleTest() { + assertEquals("content\n",html.customInlineModule("testtag","content")); + assertNotEquals("content\n",html.customInlineModule("testtag","fail")); + assertNotEquals("content",html.customInlineModule("testtag","content")); + } + + @Test + void customSingleModuleTest(){ + assertEquals("testtag>\n", html.customSingleModule("testtag")); + assertNotEquals("testtag", html.customSingleModule("testtag")); } } \ No newline at end of file