indexTest method added to TextTest

This commit is contained in:
Andrin Fassbind
2021-11-10 18:19:40 +01:00
parent 77cabcf39a
commit 549444b63c
4 changed files with 47 additions and 11 deletions
+28 -11
View File
@@ -1,13 +1,11 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
public class TextTest {
Text txt;
ArrayList<String> sListe;
@BeforeEach
void setup() {
@@ -33,15 +31,34 @@ public class TextTest {
Assertions.assertEquals(4, txt.getText().size());
}
/**
* Test methode for Index method
*/
@Test
void indexTest() {
txt.add("Hallo ?Hallo> zusammen !test!");
txt.add("Hallo, wie zusammen");
txt.add("Hallo! Wie wie zusammen");
sListe= txt.index();
for (String str : sListe){
System.out.println(str);
}
Assertions.assertEquals("Hallo 1, 2, 3",sListe.get(0));
ArrayList<String> stringListe;
//Positiv Testcase One, Three and Four Negativ Testcase Two
txt.add("Word word Test");
txt.add("Word word etc. !!test zweite... Zeile");
txt.add("Lorem ipsum lorem ipsum TEST");
stringListe = txt.index();
Assertions.assertEquals("Word 1, 2",stringListe.get(0));
Assertions.assertEquals("Test 1, 2, 3",stringListe.get(1));
//End of Test
setup();
//Positiv Testcase Two
txt.add("Word word Word Test");
stringListe = txt.index();
Assertions.assertEquals("Word 1",stringListe.get(0));
//End of Test
setup();
//Negativ Testcase One
stringListe = txt.index();
Assertions.assertEquals(0,stringListe.size());
}
}