Edited README, added test methods the test class and renamed methods by its action, filled java docs, replaced redundant code scripts
This commit is contained in:
+53
-44
@@ -15,7 +15,7 @@ public class TextTest {
|
||||
ArrayList<String> stringListe;
|
||||
|
||||
/**
|
||||
* This method is here as a preparation for the test.
|
||||
* This method prepares local parameters by resets them for each test method
|
||||
*/
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
@@ -23,6 +23,58 @@ public class TextTest {
|
||||
txt = new Text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test methode: indexNormalTest()
|
||||
* <p>
|
||||
* This test method checks, if the index method lists the words with all lines, in which they appear
|
||||
* It should return "Word 1, 2" and "Test 1, 2, 3"
|
||||
*/
|
||||
@Test
|
||||
void indexNormalTest() {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method: indexMultipleWordsTest()
|
||||
* <p>
|
||||
* This method tests if the method get the first word, which appears multiple times
|
||||
* Index() should return
|
||||
*/
|
||||
@Test
|
||||
void indexMultipleWordsTest() {
|
||||
txt.add("Word Word Word Test");
|
||||
Assertions.assertEquals("Word 1", txt.index().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method: indexEmptyTest()
|
||||
* <p>
|
||||
* Tests the method index(), when there are no text saved or available
|
||||
* It should return an empty Array with the type String
|
||||
*/
|
||||
@Test
|
||||
void indexEmptyTest() {
|
||||
Assertions.assertEquals(new ArrayList<String>(), txt.index());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method: indexWithAddedEmptyLine()
|
||||
* <p>
|
||||
* Test Method to check if the method index() is working with empty Strings
|
||||
* It should return an empty ArrayList with the type String
|
||||
*/
|
||||
@Test
|
||||
void indexWithAddedEmptyLine() {
|
||||
txt.add("");
|
||||
Assertions.assertEquals(new ArrayList<String>(), txt.index());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test Method for add and dummy methods
|
||||
*/
|
||||
@@ -75,47 +127,4 @@ public class TextTest {
|
||||
Assertions.assertEquals("Test Test hallo Test", txt.getText().get(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test methode for Index method
|
||||
* For TestCase Positiv Testcase One, Three and Four Negativ Testcase Two
|
||||
*/
|
||||
@Test
|
||||
void indexTestOne() {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test methode for Index method
|
||||
* For TestCase Positiv Testcase Two
|
||||
*/
|
||||
@Test
|
||||
void indexTestTwo() {
|
||||
txt.add("\"Word word Word Test");
|
||||
stringListe = txt.index();
|
||||
Assertions.assertEquals("Word 1", stringListe.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test methode for Index method
|
||||
* For TestCase Negativ Testcase One
|
||||
*/
|
||||
@Test
|
||||
void indexTestThree() {
|
||||
stringListe = txt.index();
|
||||
Assertions.assertEquals(0, stringListe.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Method to check if index is working with empty Strings
|
||||
*/
|
||||
@Test
|
||||
void indexTestFour() {
|
||||
txt.add("");
|
||||
txt.index();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user