From 36e2248ab3ee936576f04f5e50bfe5f3b8dd7262 Mon Sep 17 00:00:00 2001 From: Legit Cheetah Date: Tue, 6 Feb 2024 18:09:05 +0100 Subject: [PATCH] refactored to class based system --- .../{htmlTagsEnum.java => HtmlTagsEnum.java} | 4 +- src/main/Main.java | 5 +- src/main/html.java | 27 ---- src/main/htmlModules/ModuleComment.java | 17 +++ src/main/htmlModules/ModuleGeneric.java | 62 +++++++++ src/main/htmlModules/ModuleTag.java | 35 ++++++ src/main/htmlModules/tags/ModuleBody.java | 10 ++ src/main/htmlModules/tags/ModuleDiv.java | 11 ++ src/main/htmlModules/tags/ModuleHTML.java | 10 ++ src/main/htmlModules/tags/ModuleHead.java | 10 ++ src/main/htmlSites/SiteGeneric.java | 39 ++++++ src/main/htmlSites/siteGeneric.java | 39 ------ src/main/htmlTagModules/moduleBody.java | 9 -- src/main/htmlTagModules/moduleDiv.java | 10 -- src/main/htmlTagModules/moduleGeneric.java | 50 -------- src/main/htmlTagModules/moduleHTML.java | 9 -- src/main/htmlTagModules/moduleHead.java | 9 -- src/test/htmlTagsEnumTest.java | 118 +++++++++--------- src/test/htmlTest.java | 52 -------- 19 files changed, 258 insertions(+), 268 deletions(-) rename src/main/{htmlTagsEnum.java => HtmlTagsEnum.java} (95%) delete mode 100644 src/main/html.java create mode 100644 src/main/htmlModules/ModuleComment.java create mode 100644 src/main/htmlModules/ModuleGeneric.java create mode 100644 src/main/htmlModules/ModuleTag.java create mode 100644 src/main/htmlModules/tags/ModuleBody.java create mode 100644 src/main/htmlModules/tags/ModuleDiv.java create mode 100644 src/main/htmlModules/tags/ModuleHTML.java create mode 100644 src/main/htmlModules/tags/ModuleHead.java create mode 100644 src/main/htmlSites/SiteGeneric.java delete mode 100644 src/main/htmlSites/siteGeneric.java delete mode 100644 src/main/htmlTagModules/moduleBody.java delete mode 100644 src/main/htmlTagModules/moduleDiv.java delete mode 100644 src/main/htmlTagModules/moduleGeneric.java delete mode 100644 src/main/htmlTagModules/moduleHTML.java delete mode 100644 src/main/htmlTagModules/moduleHead.java delete mode 100644 src/test/htmlTest.java diff --git a/src/main/htmlTagsEnum.java b/src/main/HtmlTagsEnum.java similarity index 95% rename from src/main/htmlTagsEnum.java rename to src/main/HtmlTagsEnum.java index cbc1e16..74d7e52 100644 --- a/src/main/htmlTagsEnum.java +++ b/src/main/HtmlTagsEnum.java @@ -1,6 +1,6 @@ package main; -public enum htmlTagsEnum { +public enum HtmlTagsEnum { //TestTag is only for testing, it is not a valid Html Tag! TESTTAG("testtag"), ABBREVIATION("abb"), @@ -69,7 +69,7 @@ public enum htmlTagsEnum { return this.tag; } - private htmlTagsEnum(String tag){ + private HtmlTagsEnum(String tag){ this.tag = tag; } } diff --git a/src/main/Main.java b/src/main/Main.java index da01e1f..a8d07df 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -1,10 +1,11 @@ package main; -import main.htmlSites.siteGeneric; +import main.htmlSites.SiteGeneric; public class Main { public static void main(String[] args) { - siteGeneric site = new siteGeneric(); + SiteGeneric site = new SiteGeneric(); + site.setID("1"); System.out.println(site.build()); } } diff --git a/src/main/html.java b/src/main/html.java deleted file mode 100644 index 056a1c6..0000000 --- a/src/main/html.java +++ /dev/null @@ -1,27 +0,0 @@ -package main; - -public class html { - public String htmlContentModule(htmlTagsEnum tag, String content){ - return "<"+tag.getTag()+">\n"+content+"\n\n"; - } - - public String htmlInlineModule(htmlTagsEnum tag, String content){ - 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"; - } - - public String customInlineModule(String tag, String content){ - return "<"+tag+">"+content+"\n"; - } - - public String customSingleModule(String tag){ - return "<"+tag+">\n"; - } -} diff --git a/src/main/htmlModules/ModuleComment.java b/src/main/htmlModules/ModuleComment.java new file mode 100644 index 0000000..99594db --- /dev/null +++ b/src/main/htmlModules/ModuleComment.java @@ -0,0 +1,17 @@ +package main.htmlModules; + +public class ModuleComment extends ModuleGeneric { + public ModuleComment(String comment){ + this.comment = comment; + } + + @Override + public StringBuilder build() { + StringBuilder output = new StringBuilder(); + output + .append(""); + return output; + } +} diff --git a/src/main/htmlModules/ModuleGeneric.java b/src/main/htmlModules/ModuleGeneric.java new file mode 100644 index 0000000..4e25206 --- /dev/null +++ b/src/main/htmlModules/ModuleGeneric.java @@ -0,0 +1,62 @@ +package main.htmlModules; + +import main.HtmlTagsEnum; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class ModuleGeneric { + + protected HtmlTagsEnum tag = null; + protected String comment; + protected List content = new ArrayList<>(); + + //Global Attributes + protected char accessKey; + protected String styleClass; + protected Boolean contentEditable; + protected String dataPrefix; + protected String dataValue; + protected String dir; + protected Enum draggable; + protected String enterKeyHint; + protected boolean hidden; + protected String id; + protected boolean inert; + protected Enum inputMethod; + protected Enum lang; + protected boolean popOver; + protected String popOverTaret; + protected Boolean spellcheck; + protected HashMap style; + protected int tabIndex; + protected String title; + protected Boolean translate; + + // + + + public StringBuilder build(){ + StringBuilder buildString = new StringBuilder(); + buildString + .append("\n<") + .append(tag.getTag()) + .append(id != null ? " id=\"" + id +"\"" : "") + .append(">"); + + for (ModuleGeneric moduleGeneric : content) { + if(moduleGeneric instanceof ModuleComment moduleComment){ + buildString.append(moduleComment.build()); + }else{ + buildString.append(moduleGeneric.build()); + } + } + + buildString + .append("\n"); + return buildString; + } +} diff --git a/src/main/htmlModules/ModuleTag.java b/src/main/htmlModules/ModuleTag.java new file mode 100644 index 0000000..6bcaaa5 --- /dev/null +++ b/src/main/htmlModules/ModuleTag.java @@ -0,0 +1,35 @@ +package main.htmlModules; + +import main.HtmlTagsEnum; + +public class ModuleTag extends ModuleGeneric { + public ModuleTag(){ + + } + + public void addModule(ModuleGeneric module){ + content.add(module); + } + + public void addComment(String comment){ + content.add(new ModuleComment(comment)); + } + + + + public void setID(String ID) { + this.id = ID; + } + + public String getID() { + return id; + } + + public void setTag(HtmlTagsEnum tag) { + this.tag = tag; + } + + public HtmlTagsEnum getTag() { + return tag; + } +} diff --git a/src/main/htmlModules/tags/ModuleBody.java b/src/main/htmlModules/tags/ModuleBody.java new file mode 100644 index 0000000..7d55679 --- /dev/null +++ b/src/main/htmlModules/tags/ModuleBody.java @@ -0,0 +1,10 @@ +package main.htmlModules.tags; + +import main.HtmlTagsEnum; +import main.htmlModules.ModuleTag; + +public class ModuleBody extends ModuleTag { + public ModuleBody(){ + setTag(HtmlTagsEnum.BODY); + } +} diff --git a/src/main/htmlModules/tags/ModuleDiv.java b/src/main/htmlModules/tags/ModuleDiv.java new file mode 100644 index 0000000..bfda089 --- /dev/null +++ b/src/main/htmlModules/tags/ModuleDiv.java @@ -0,0 +1,11 @@ +package main.htmlModules.tags; + +import main.HtmlTagsEnum; +import main.htmlModules.ModuleTag; + +public class ModuleDiv extends ModuleTag { + + public ModuleDiv(){ + setTag(HtmlTagsEnum.DIV); + } +} diff --git a/src/main/htmlModules/tags/ModuleHTML.java b/src/main/htmlModules/tags/ModuleHTML.java new file mode 100644 index 0000000..a6d76b8 --- /dev/null +++ b/src/main/htmlModules/tags/ModuleHTML.java @@ -0,0 +1,10 @@ +package main.htmlModules.tags; + +import main.HtmlTagsEnum; +import main.htmlModules.ModuleTag; + +public class ModuleHTML extends ModuleTag { + public ModuleHTML(){ + setTag(HtmlTagsEnum.HTML); + } +} diff --git a/src/main/htmlModules/tags/ModuleHead.java b/src/main/htmlModules/tags/ModuleHead.java new file mode 100644 index 0000000..d3d2d4e --- /dev/null +++ b/src/main/htmlModules/tags/ModuleHead.java @@ -0,0 +1,10 @@ +package main.htmlModules.tags; + +import main.HtmlTagsEnum; +import main.htmlModules.ModuleTag; + +public class ModuleHead extends ModuleTag { + public ModuleHead(){ + setTag(HtmlTagsEnum.HEAD); + } +} diff --git a/src/main/htmlSites/SiteGeneric.java b/src/main/htmlSites/SiteGeneric.java new file mode 100644 index 0000000..fd2c1c0 --- /dev/null +++ b/src/main/htmlSites/SiteGeneric.java @@ -0,0 +1,39 @@ +package main.htmlSites; + +import main.htmlModules.tags.ModuleBody; +import main.htmlModules.tags.ModuleHead; +import main.htmlModules.ModuleTag; +import main.HtmlTagsEnum; + +public class SiteGeneric extends ModuleTag { + ModuleHead head; + ModuleBody body; + public SiteGeneric(){ + this(new ModuleHead(),new ModuleBody()); + } + + public SiteGeneric(ModuleHead head){ + this(head ,new ModuleBody()); + } + + public SiteGeneric(ModuleBody body){ + this(new ModuleHead(),body); + } + + SiteGeneric(ModuleHead head, ModuleBody body){ + this.head = head; + this.body = body; + setTag(HtmlTagsEnum.HTML); + addModule(this.head); + addModule(this.body); + } + + @Override + public StringBuilder build() { + StringBuilder buildString = new StringBuilder(); + buildString + .append("") + .append(super.build()); + return buildString; + } +} diff --git a/src/main/htmlSites/siteGeneric.java b/src/main/htmlSites/siteGeneric.java deleted file mode 100644 index bbb5573..0000000 --- a/src/main/htmlSites/siteGeneric.java +++ /dev/null @@ -1,39 +0,0 @@ -package main.htmlSites; - -import main.htmlTagModules.moduleBody; -import main.htmlTagModules.moduleGeneric; -import main.htmlTagModules.moduleHead; -import main.htmlTagsEnum; - -public class siteGeneric extends moduleGeneric { - moduleHead head; - moduleBody body; - public siteGeneric(){ - this(new moduleHead(),new moduleBody()); - } - - public siteGeneric(moduleHead head){ - this(head ,new moduleBody()); - } - - public siteGeneric(moduleBody body){ - this(new moduleHead(),body); - } - - siteGeneric(moduleHead head, moduleBody body){ - this.head = head; - this.body = body; - setTag(htmlTagsEnum.HTML); - addModule(this.head); - addModule(this.body); - } - - @Override - public StringBuilder build() { - StringBuilder buildString = new StringBuilder(); - buildString - .append("") - .append(super.build()); - return buildString; - } -} diff --git a/src/main/htmlTagModules/moduleBody.java b/src/main/htmlTagModules/moduleBody.java deleted file mode 100644 index bf7a834..0000000 --- a/src/main/htmlTagModules/moduleBody.java +++ /dev/null @@ -1,9 +0,0 @@ -package main.htmlTagModules; - -import main.htmlTagsEnum; - -public class moduleBody extends moduleGeneric{ - public moduleBody(){ - setTag(htmlTagsEnum.BODY); - } -} diff --git a/src/main/htmlTagModules/moduleDiv.java b/src/main/htmlTagModules/moduleDiv.java deleted file mode 100644 index 01c6588..0000000 --- a/src/main/htmlTagModules/moduleDiv.java +++ /dev/null @@ -1,10 +0,0 @@ -package main.htmlTagModules; - -import main.htmlTagsEnum; - -public class moduleDiv extends moduleGeneric { - - public moduleDiv(){ - setTag(htmlTagsEnum.DIV); - } -} diff --git a/src/main/htmlTagModules/moduleGeneric.java b/src/main/htmlTagModules/moduleGeneric.java deleted file mode 100644 index f160588..0000000 --- a/src/main/htmlTagModules/moduleGeneric.java +++ /dev/null @@ -1,50 +0,0 @@ -package main.htmlTagModules; - -import main.htmlTagsEnum; - -import java.util.ArrayList; - -public class moduleGeneric { - - htmlTagsEnum tag = null; - int ID; - - - ArrayList content = new ArrayList<>(); - - public void addModule(moduleGeneric module){ - content.add(module); - } - - public void setID(int ID) { - this.ID = ID; - } - - public int getID() { - return ID; - } - - public void setTag(htmlTagsEnum tag) { - this.tag = tag; - } - - public htmlTagsEnum getTag() { - return tag; - } - - public StringBuilder build(){ - StringBuilder buildString = new StringBuilder(); - buildString - .append("\n<") - .append(tag.getTag()) - .append(">"); - for (main.htmlTagModules.moduleGeneric moduleGeneric : content) { - buildString.append(moduleGeneric.build()); - } - buildString - .append("\n"); - return buildString; - } -} diff --git a/src/main/htmlTagModules/moduleHTML.java b/src/main/htmlTagModules/moduleHTML.java deleted file mode 100644 index 90333a5..0000000 --- a/src/main/htmlTagModules/moduleHTML.java +++ /dev/null @@ -1,9 +0,0 @@ -package main.htmlTagModules; - -import main.htmlTagsEnum; - -public class moduleHTML extends moduleGeneric{ - public moduleHTML(){ - setTag(htmlTagsEnum.HTML); - } -} diff --git a/src/main/htmlTagModules/moduleHead.java b/src/main/htmlTagModules/moduleHead.java deleted file mode 100644 index 988fd8a..0000000 --- a/src/main/htmlTagModules/moduleHead.java +++ /dev/null @@ -1,9 +0,0 @@ -package main.htmlTagModules; - -import main.htmlTagsEnum; - -public class moduleHead extends moduleGeneric { - public moduleHead(){ - setTag(htmlTagsEnum.HEAD); - } -} diff --git a/src/test/htmlTagsEnumTest.java b/src/test/htmlTagsEnumTest.java index 6951001..9695023 100644 --- a/src/test/htmlTagsEnumTest.java +++ b/src/test/htmlTagsEnumTest.java @@ -1,6 +1,6 @@ package test; -import main.htmlTagsEnum; +import main.HtmlTagsEnum; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -9,63 +9,63 @@ public class htmlTagsEnumTest { @Test void htmlTagsEnumTagsTest(){ - assertEquals(htmlTagsEnum.ABBREVIATION.getTag(),"abb"); - assertEquals(htmlTagsEnum.ADDRESS.getTag(),"address"); - assertEquals(htmlTagsEnum.ARTICLE.getTag(),"article"); - assertEquals(htmlTagsEnum.ASIDE.getTag(),"aside"); - assertEquals(htmlTagsEnum.BLINK.getTag(),"blink"); - assertEquals(htmlTagsEnum.BIDIRECTIONALTEXTOVERRIDE.getTag(),"bdo"); - assertEquals(htmlTagsEnum.BODY.getTag(),"body"); - assertEquals(htmlTagsEnum.BOLD.getTag(),"b"); - assertEquals(htmlTagsEnum.BREAK.getTag(),"br"); - assertEquals(htmlTagsEnum.CANVAS.getTag(),"canvas"); - assertEquals(htmlTagsEnum.CODE.getTag(),"code"); - assertEquals(htmlTagsEnum.DELETE.getTag(),"delete"); - assertEquals(htmlTagsEnum.DIV.getTag(),"div"); - assertEquals(htmlTagsEnum.FIGURE.getTag(),"figure"); - assertEquals(htmlTagsEnum.FIGURECAPTION.getTag(),"figcaption"); - assertEquals(htmlTagsEnum.FOOTER.getTag(),"footer"); - assertEquals(htmlTagsEnum.FORM.getTag(),"form"); - assertEquals(htmlTagsEnum.HEAD.getTag(),"head"); - assertEquals(htmlTagsEnum.HEADER.getTag(),"header"); - assertEquals(htmlTagsEnum.HEADLINE1.getTag(),"h1"); - assertEquals(htmlTagsEnum.HEADLINE2.getTag(),"h2"); - assertEquals(htmlTagsEnum.HEADLINE3.getTag(),"h3"); - assertEquals(htmlTagsEnum.HEADLINE4.getTag(),"h4"); - assertEquals(htmlTagsEnum.HEADLINE5.getTag(),"h5"); - assertEquals(htmlTagsEnum.HEADLINE6.getTag(),"h6"); - assertEquals(htmlTagsEnum.INPUT.getTag(),"input"); - assertEquals(htmlTagsEnum.INSERT.getTag(),"insert"); - assertEquals(htmlTagsEnum.INTERNETFRAME.getTag(),"iframe"); - assertEquals(htmlTagsEnum.ITALICS.getTag(),"i"); - assertEquals(htmlTagsEnum.KEYGEN.getTag(),"keygen"); - assertEquals(htmlTagsEnum.LINK.getTag(),"a"); - assertEquals(htmlTagsEnum.LISTITEM.getTag(),"li"); - assertEquals(htmlTagsEnum.LISTORDERED.getTag(),"ol"); - assertEquals(htmlTagsEnum.LISTUNORDERED.getTag(),"ul"); - assertEquals(htmlTagsEnum.MAIN.getTag(),"main"); - assertEquals(htmlTagsEnum.MARQUEE.getTag(),"marquee"); - assertEquals(htmlTagsEnum.MENU.getTag(),"menu"); - assertEquals(htmlTagsEnum.META.getTag(),"meta"); - assertEquals(htmlTagsEnum.NAVIGATION.getTag(),"nav"); - assertEquals(htmlTagsEnum.PARAGRAPH.getTag(),"p"); - assertEquals(htmlTagsEnum.PRETAG.getTag(),"pretag"); - assertEquals(htmlTagsEnum.RUBY.getTag(),"ruby"); - assertEquals(htmlTagsEnum.RUBYPARENTHESIS.getTag(),"rp"); - assertEquals(htmlTagsEnum.RUBYTEXT.getTag(),"rt"); - assertEquals(htmlTagsEnum.SCRIPT.getTag(),"script"); - assertEquals(htmlTagsEnum.SECTION.getTag(),"section"); - assertEquals(htmlTagsEnum.SMALL.getTag(),"small"); - assertEquals(htmlTagsEnum.SPAN.getTag(),"span"); - assertEquals(htmlTagsEnum.STRIKE.getTag(),"s"); - assertEquals(htmlTagsEnum.TABLE.getTag(),"table"); - assertEquals(htmlTagsEnum.TABLECOLUM.getTag(),"td"); - assertEquals(htmlTagsEnum.TABLECOLUMNTITLE.getTag(),"th"); - assertEquals(htmlTagsEnum.TABLEROW.getTag(),"tr"); - assertEquals(htmlTagsEnum.TEXTAREA.getTag(),"textarea"); - assertEquals(htmlTagsEnum.TITLE.getTag(),"title"); - assertEquals(htmlTagsEnum.UNDERLINE.getTag(),"u"); - assertEquals(htmlTagsEnum.VARIABLE.getTag(),"var"); - assertEquals(htmlTagsEnum.WANTEDBREAK.getTag(),"wbr"); + assertEquals(HtmlTagsEnum.ABBREVIATION.getTag(),"abb"); + assertEquals(HtmlTagsEnum.ADDRESS.getTag(),"address"); + assertEquals(HtmlTagsEnum.ARTICLE.getTag(),"article"); + assertEquals(HtmlTagsEnum.ASIDE.getTag(),"aside"); + assertEquals(HtmlTagsEnum.BLINK.getTag(),"blink"); + assertEquals(HtmlTagsEnum.BIDIRECTIONALTEXTOVERRIDE.getTag(),"bdo"); + assertEquals(HtmlTagsEnum.BODY.getTag(),"body"); + assertEquals(HtmlTagsEnum.BOLD.getTag(),"b"); + assertEquals(HtmlTagsEnum.BREAK.getTag(),"br"); + assertEquals(HtmlTagsEnum.CANVAS.getTag(),"canvas"); + assertEquals(HtmlTagsEnum.CODE.getTag(),"code"); + assertEquals(HtmlTagsEnum.DELETE.getTag(),"delete"); + assertEquals(HtmlTagsEnum.DIV.getTag(),"div"); + assertEquals(HtmlTagsEnum.FIGURE.getTag(),"figure"); + assertEquals(HtmlTagsEnum.FIGURECAPTION.getTag(),"figcaption"); + assertEquals(HtmlTagsEnum.FOOTER.getTag(),"footer"); + assertEquals(HtmlTagsEnum.FORM.getTag(),"form"); + assertEquals(HtmlTagsEnum.HEAD.getTag(),"head"); + assertEquals(HtmlTagsEnum.HEADER.getTag(),"header"); + assertEquals(HtmlTagsEnum.HEADLINE1.getTag(),"h1"); + assertEquals(HtmlTagsEnum.HEADLINE2.getTag(),"h2"); + assertEquals(HtmlTagsEnum.HEADLINE3.getTag(),"h3"); + assertEquals(HtmlTagsEnum.HEADLINE4.getTag(),"h4"); + assertEquals(HtmlTagsEnum.HEADLINE5.getTag(),"h5"); + assertEquals(HtmlTagsEnum.HEADLINE6.getTag(),"h6"); + assertEquals(HtmlTagsEnum.INPUT.getTag(),"input"); + assertEquals(HtmlTagsEnum.INSERT.getTag(),"insert"); + assertEquals(HtmlTagsEnum.INTERNETFRAME.getTag(),"iframe"); + assertEquals(HtmlTagsEnum.ITALICS.getTag(),"i"); + assertEquals(HtmlTagsEnum.KEYGEN.getTag(),"keygen"); + assertEquals(HtmlTagsEnum.LINK.getTag(),"a"); + assertEquals(HtmlTagsEnum.LISTITEM.getTag(),"li"); + assertEquals(HtmlTagsEnum.LISTORDERED.getTag(),"ol"); + assertEquals(HtmlTagsEnum.LISTUNORDERED.getTag(),"ul"); + assertEquals(HtmlTagsEnum.MAIN.getTag(),"main"); + assertEquals(HtmlTagsEnum.MARQUEE.getTag(),"marquee"); + assertEquals(HtmlTagsEnum.MENU.getTag(),"menu"); + assertEquals(HtmlTagsEnum.META.getTag(),"meta"); + assertEquals(HtmlTagsEnum.NAVIGATION.getTag(),"nav"); + assertEquals(HtmlTagsEnum.PARAGRAPH.getTag(),"p"); + assertEquals(HtmlTagsEnum.PRETAG.getTag(),"pretag"); + assertEquals(HtmlTagsEnum.RUBY.getTag(),"ruby"); + assertEquals(HtmlTagsEnum.RUBYPARENTHESIS.getTag(),"rp"); + assertEquals(HtmlTagsEnum.RUBYTEXT.getTag(),"rt"); + assertEquals(HtmlTagsEnum.SCRIPT.getTag(),"script"); + assertEquals(HtmlTagsEnum.SECTION.getTag(),"section"); + assertEquals(HtmlTagsEnum.SMALL.getTag(),"small"); + assertEquals(HtmlTagsEnum.SPAN.getTag(),"span"); + assertEquals(HtmlTagsEnum.STRIKE.getTag(),"s"); + assertEquals(HtmlTagsEnum.TABLE.getTag(),"table"); + assertEquals(HtmlTagsEnum.TABLECOLUM.getTag(),"td"); + assertEquals(HtmlTagsEnum.TABLECOLUMNTITLE.getTag(),"th"); + assertEquals(HtmlTagsEnum.TABLEROW.getTag(),"tr"); + assertEquals(HtmlTagsEnum.TEXTAREA.getTag(),"textarea"); + assertEquals(HtmlTagsEnum.TITLE.getTag(),"title"); + assertEquals(HtmlTagsEnum.UNDERLINE.getTag(),"u"); + assertEquals(HtmlTagsEnum.VARIABLE.getTag(),"var"); + assertEquals(HtmlTagsEnum.WANTEDBREAK.getTag(),"wbr"); } } diff --git a/src/test/htmlTest.java b/src/test/htmlTest.java deleted file mode 100644 index e928bf1..0000000 --- a/src/test/htmlTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package test; - -import main.html; -import main.htmlTagsEnum; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; - -class htmlTest { - html html = new main.html(); - - @Test - void htmlContentModuleTest() { - 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("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\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