Add tests for the WellformedXmlServer
This commit is contained in:
parent
f53e58a3b8
commit
3081d67e0f
1 changed files with 34 additions and 0 deletions
34
app/src/test/java/ch/nuth/zhaw/exbox/ADS1_4_test.java
Normal file
34
app/src/test/java/ch/nuth/zhaw/exbox/ADS1_4_test.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package ch.nuth.zhaw.exbox;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
public class ADS1_4_test {
|
||||||
|
WellformedXmlServer xml;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
xml = new WellformedXmlServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void test(String content, boolean expected) {
|
||||||
|
assertEquals(expected, xml.checkWellformed(content), content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testXmlAttributes() {
|
||||||
|
test("<a href=\"sugus\"></a>", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testXml() {
|
||||||
|
test("<a></a>", true);
|
||||||
|
test("<a>", false);
|
||||||
|
test("</a>", false);
|
||||||
|
test("<a/>", true);
|
||||||
|
test("<a><b></b></a>", true);
|
||||||
|
test("<a><b></a></b>", false);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue