Adding unit test for Student grade
This commit is contained in:
parent
a0015b4dfb
commit
4dd44a29d8
|
@ -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() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue