parent
fb394cc8af
commit
738f7ed663
1 changed files with 45 additions and 45 deletions
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @(#) DictionaryControllerTest.java 0,1 2020/04/07
|
||||
* @(#) DictionaryEntryTest.java 0,1 2020/05/01
|
||||
* <p>
|
||||
* Copyright (c) 2020 Aberystwyth University.
|
||||
* All rights reserved.
|
||||
|
@ -20,55 +20,55 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||
*/
|
||||
class DictionaryEntryTest {
|
||||
|
||||
LinkedList<DictionaryEntry> testList;
|
||||
LinkedList<DictionaryEntry> testList;
|
||||
|
||||
/**
|
||||
* Tests whether the default constructor sets isPracticeWord to false upon declaration of a new DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
void testPracticeWordFalse(){
|
||||
DictionaryEntry testDefaultConstructor = new DictionaryEntry();
|
||||
assertFalse(testDefaultConstructor.isPracticeWord());
|
||||
}
|
||||
/**
|
||||
* Tests whether the default constructor sets isPracticeWord to false upon declaration of a new DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
void testPracticeWordFalse(){
|
||||
DictionaryEntry testDefaultConstructor = new DictionaryEntry();
|
||||
assertFalse(testDefaultConstructor.isPracticeWord());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the setters and getters of the DictionaryEntry class work as intended.
|
||||
*/
|
||||
@Test
|
||||
void testAllSettersAndGetters() {
|
||||
String english = "abbey";
|
||||
String welsh = "abaty";
|
||||
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
|
||||
/**
|
||||
* Tests whether the setters and getters of the DictionaryEntry class work as intended.
|
||||
*/
|
||||
@Test
|
||||
void testAllSettersAndGetters() {
|
||||
String english = "abbey";
|
||||
String welsh = "abaty";
|
||||
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
|
||||
|
||||
DictionaryEntry testSettersAndGetters = new DictionaryEntry();
|
||||
testSettersAndGetters.setEnglish(english);
|
||||
testSettersAndGetters.setWelsh(welsh);
|
||||
testSettersAndGetters.setWordType(wordType);
|
||||
assertTrue(testSettersAndGetters.getEnglish().equals(english) &&
|
||||
testSettersAndGetters.getWelsh().equals(welsh) &&
|
||||
testSettersAndGetters.getWordType().equals(wordType));
|
||||
}
|
||||
DictionaryEntry testSettersAndGetters = new DictionaryEntry();
|
||||
testSettersAndGetters.setEnglish(english);
|
||||
testSettersAndGetters.setWelsh(welsh);
|
||||
testSettersAndGetters.setWordType(wordType);
|
||||
assertTrue(testSettersAndGetters.getEnglish().equals(english) &&
|
||||
testSettersAndGetters.getWelsh().equals(welsh) &&
|
||||
testSettersAndGetters.getWordType().equals(wordType));
|
||||
}
|
||||
|
||||
/**
|
||||
* A true-positive test for the equals method in DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
public void testEqualsTruePossitive() {
|
||||
String english = "abbey";
|
||||
String welsh = "abaty";
|
||||
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
|
||||
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry(english,welsh,wordType),new DictionaryEntry(english,welsh,wordType)));
|
||||
assertTrue(testList.get(0).equals(testList.get(1)));
|
||||
}
|
||||
/**
|
||||
* A true-positive test for the equals method in DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
public void testEqualsTruePossitive() {
|
||||
String english = "abbey";
|
||||
String welsh = "abaty";
|
||||
DictionaryEntry.wordTypeEnum wordType = DictionaryEntry.wordTypeEnum.nm;
|
||||
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry(english,welsh,wordType),new DictionaryEntry(english,welsh,wordType)));
|
||||
assertTrue(testList.get(0).equals(testList.get(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* A true-negative test for the equals method in DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
public void testEqualsTrueNegative(){
|
||||
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty", DictionaryEntry.wordTypeEnum.nm),new DictionaryEntry("above","dramor", DictionaryEntry.wordTypeEnum.other)));
|
||||
assertFalse(testList.get(0).equals(testList.get(1)));
|
||||
}
|
||||
/**
|
||||
* A true-negative test for the equals method in DictionaryEntry.
|
||||
*/
|
||||
@Test
|
||||
public void testEqualsTrueNegative(){
|
||||
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty", DictionaryEntry.wordTypeEnum.nm),new DictionaryEntry("above","dramor", DictionaryEntry.wordTypeEnum.other)));
|
||||
assertFalse(testList.get(0).equals(testList.get(1)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Reference in a new issue