import static org.junit.Assert.*; import org.junit.Test; public class StudentTesting { //NOTE: If we wanted to do protected, we could make the UID coverters // protected and test them on their own here... @Test public void testOne() { String nameForTest = "Fred"; String nicknameForTest = "Fredo"; int uidForTest = 123456789; Student exampleStudent = new Student(nameForTest, nicknameForTest, uidForTest); assertEquals(nameForTest, exampleStudent.getName()); assertEquals(nicknameForTest,exampleStudent.getNickname()); assertEquals(uidForTest, exampleStudent.getUID()); assertTrue(0.0 == exampleStudent.getScore()); } @Test public void testAppendNickname() { String nameForTest = "Fred"; String nicknameForTest = "Fredo"; String nicknameAdditionForTest = "II"; int uidForTest = 123456789; Student exampleStudent = new Student(nameForTest, nicknameForTest, uidForTest); exampleStudent.appendNickname(nicknameAdditionForTest); assertEquals(nicknameForTest+nicknameAdditionForTest,exampleStudent.getNickname()); } @Test public void testEquals() { String nameForTest = "Fred"; String nicknameForTest = "Fredo"; int uidForTest = 123456789; Student exampleStudent1 = new Student(nameForTest, nicknameForTest, uidForTest); Student exampleStudent2 = new Student(nameForTest, nicknameForTest, uidForTest); assertEquals(exampleStudent1, exampleStudent2); assertTrue(exampleStudent1.equals(exampleStudent2)); assertFalse(exampleStudent1==exampleStudent2); } } //Copyright 2010-2016 Evan Golub