indexTest method added to TextTest
This commit is contained in:
+28
-11
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user