DictionaryEntryTest fixed indentation and date

- Issue #43
This commit is contained in:
osp1 2020-05-01 15:35:01 +01:00
parent fb394cc8af
commit 738f7ed663

View file

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