Fixed issues with selfAssessment package

This commit is contained in:
kab74 2020-05-01 13:44:31 +01:00
parent 9d4eb318f1
commit 6de32a77c0

View file

@ -1,17 +1,20 @@
package uk.ac.aber.cs22120.group20.test;
import org.junit.jupiter.api.Test;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry.*;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import uk.ac.aber.cs22120.group20.json.JsonProcessing;
import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
/**
* A test class for various tests regarding DictionaryEntry.
* @Author Kab74
*/
class DictionaryEntryTest {
LinkedList<DictionaryEntry> testList;
JsonProcessing processor = new JsonProcessing();
/**
* Tests whether the default constructor sets isPracticeWord to false upon declaration of a new DictionaryEntry.
@ -29,7 +32,8 @@ class DictionaryEntryTest {
void testAllSettersAndGetters() {
String english = "abbey";
String welsh = "abaty";
String wordType = "nm";
wordTypeEnum wordType = wordTypeEnum.nm;
DictionaryEntry testSettersAndGetters = new DictionaryEntry();
testSettersAndGetters.setEnglish(english);
testSettersAndGetters.setWelsh(welsh);
@ -46,7 +50,7 @@ class DictionaryEntryTest {
public void testEqualsTruePossitive() {
String english = "abbey";
String welsh = "abaty";
String wordType = "nm";
wordTypeEnum wordType = 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)));
}
@ -56,7 +60,7 @@ class DictionaryEntryTest {
*/
@Test
public void testEqualsTrueNegative(){
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty","nm"),new DictionaryEntry("above","dramor","other")));
testList = new LinkedList<>(Arrays.asList(new DictionaryEntry("abbey","abaty", wordTypeEnum.nm),new DictionaryEntry("above","dramor",wordTypeEnum.other)));
assertFalse(testList.get(0).equals(testList.get(1)));
}