2021-11-05 11:35:09 +01:00
|
|
|
import org.junit.jupiter.api.Assertions;
|
2021-11-05 09:14:26 +01:00
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2021-11-04 14:19:58 +01:00
|
|
|
public class TextTest {
|
2021-11-05 09:14:26 +01:00
|
|
|
Text txt;
|
|
|
|
ArrayList<String> sListe;
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
void setup() {
|
|
|
|
txt = new Text();
|
|
|
|
}
|
|
|
|
|
2021-11-10 13:55:59 +01:00
|
|
|
/**
|
|
|
|
* Test Method for add and dummy methods
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
void addTest() {
|
|
|
|
Assertions.assertEquals(0, txt.getText().size());
|
|
|
|
Assertions.assertEquals(false, txt.add(1, "test"));
|
|
|
|
Assertions.assertEquals(false, txt.dummy(1));
|
|
|
|
Assertions.assertEquals(0, txt.getText().size());
|
|
|
|
Assertions.assertEquals(true, txt.add("test1"));
|
|
|
|
Assertions.assertEquals(true, txt.add(1, "test2"));
|
|
|
|
Assertions.assertEquals("test2", txt.getText().get(0));
|
|
|
|
Assertions.assertEquals("test1", txt.getText().get(1));
|
|
|
|
Assertions.assertEquals(true, txt.dummy(2));
|
|
|
|
Assertions.assertEquals(true, txt.dummy());
|
|
|
|
Assertions.assertEquals(true, txt.getText().get(1).equals(txt.getText().get(3)));
|
|
|
|
Assertions.assertEquals(4, txt.getText().size());
|
|
|
|
}
|
|
|
|
|
2021-11-05 09:14:26 +01:00
|
|
|
@Test
|
|
|
|
void indexTest() {
|
2021-11-05 17:59:26 +01:00
|
|
|
txt.add("Hallo ?Hallo> zusammen !test!");
|
2021-11-05 11:35:09 +01:00
|
|
|
txt.add("Hallo, wie zusammen");
|
2021-11-05 17:59:26 +01:00
|
|
|
txt.add("Hallo! Wie wie zusammen");
|
2021-11-05 11:35:09 +01:00
|
|
|
sListe= txt.index();
|
2021-11-05 17:59:26 +01:00
|
|
|
for (String str : sListe){
|
|
|
|
System.out.println(str);
|
|
|
|
}
|
|
|
|
Assertions.assertEquals("Hallo 1, 2, 3",sListe.get(0));
|
2021-11-05 09:14:26 +01:00
|
|
|
}
|
2021-11-04 14:19:58 +01:00
|
|
|
}
|