Adding unit test for Student grade

This commit is contained in:
m.raheem 2019-08-24 13:50:24 +02:00
parent a0015b4dfb
commit 4dd44a29d8
1 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,8 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import com.baeldung.accessmodifiers.publicmodifier.ListOfThree;
import com.baeldung.accessmodifiers.publicmodifier.Student;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -28,6 +30,15 @@ public class PublicAccessModifierUnitTest {
assertEquals(2147483647, Integer.MAX_VALUE); //static field
}
@Test
public void whenChangingStudentInternalRepresentation_clientCodeWillNotBreak() {
Student student = new Student();
student.setGrade(100);
assertEquals(100, student.getGrade());
}
@Test
public void whenUsingEntrySet_keyValuePairsAreReturned() {