html.java SingleModules added and corrections

htmlTest.java new tests and corrections
This commit is contained in:
LegitCheetah 2024-01-25 00:58:20 +01:00
parent bd20b218d5
commit a8e1924175
2 changed files with 36 additions and 9 deletions

View File

@ -9,6 +9,10 @@ public class html {
return "<"+tag.getTag()+">"+content+"</"+tag.getTag()+">\n";
}
public String htmlSingleModule(htmlTagsEnum tag){
return "<"+tag.getTag()+">\n";
}
public String customContentModule(String tag, String content){
return "<"+tag+">\n"+content+"\n</"+tag+">\n";
}
@ -16,4 +20,8 @@ public class html {
public String customInlineModule(String tag, String content){
return "<"+tag+">"+content+"</"+tag+">\n";
}
public String customSingleModule(String tag){
return "<"+tag+">\n";
}
}

View File

@ -12,22 +12,41 @@ class htmlTest {
@Test
void htmlContentModuleTest() {
assertEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.PRETAG,"content"));
assertEquals("<testtag>\ncontent\n</testtag>\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>\ncontent\n</testtag>\n",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
}
@Test
void htmlInlineModuleTest() {
assertEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.htmlContentModule(htmlTagsEnum.PRETAG,"content"));
assertEquals("<testtag>content</testtag>\n",html.htmlInlineModule(htmlTagsEnum.TESTTAG,"content"));
assertNotEquals("<testtag>content</testtag>\n",html.htmlInlineModule(htmlTagsEnum.TESTTAG,"fail"));
assertNotEquals("<testtag>content</testtag>",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("<testtag>\ncontent\n</testtag>",html.customContentModule("testtag","content"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("testtag","fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("pretag","content"));
assertEquals("<testtag>\ncontent\n</testtag>\n",html.customContentModule("testtag","content"));
assertNotEquals("<testtag>\ncontent\n</testtag>\n",html.customContentModule("testtag","fail"));
assertNotEquals("<testtag>\ncontent\n</testtag>",html.customContentModule("testtag","content"));
}
@Test
void customInlineModuleTest() {
assertEquals("<testtag>content</testtag>\n",html.customInlineModule("testtag","content"));
assertNotEquals("<testtag>content</testtag>\n",html.customInlineModule("testtag","fail"));
assertNotEquals("<testtag>content</testtag>",html.customInlineModule("testtag","content"));
}
@Test
void customSingleModuleTest(){
assertEquals("testtag>\n", html.customSingleModule("testtag"));
assertNotEquals("testtag", html.customSingleModule("testtag"));
}
}