11package com .codedifferently .lesson16 .xaviercruz ;
22
3- import static org .junit .jupiter .api .Assertions .assertEquals ;
4- import static org .junit .jupiter .api .Assertions .assertThrows ;
5-
63import java .util .ArrayList ;
74import java .util .Arrays ;
85
6+ import static org .junit .jupiter .api .Assertions .assertEquals ;
7+ import static org .junit .jupiter .api .Assertions .assertThrows ;
98import org .junit .jupiter .api .Test ;
109
1110public class PersonTest {
@@ -16,6 +15,12 @@ public void testGetName(){
1615 assertEquals ("That one guy right there" , person .getName ());
1716 }
1817
18+ @ Test
19+ public void testChangeName (){
20+ person .changeName ("new name right here bruh" );
21+ assertEquals ("new name right here bruh" , person .getName ());
22+ }
23+
1924 @ Test
2025 public void testGetAge (){
2126 assertEquals (25 , person .getAge ());
@@ -49,12 +54,21 @@ public void testUpdateAge(){
4954 }
5055
5156 @ Test
52- public void testAddToTraits_Exception () throws TooManyTraitsException {
57+ public void testAddToTraits_Exception (){
5358 String [] newTraits = new String []{"test" , "test" , "test" , "test" , "test" , "test" , "test" };
5459 assertThrows (TooManyTraitsException .class , () -> {
5560 person .addToTraits (newTraits );
5661 });
5762 }
5863
64+ @ Test
65+ public void testSetEyeColor () {
66+ Color color = Color .GREEN ;
67+
68+ person .setEyeColor (color );
69+
70+ assertEquals (Color .GREEN , person .getEyeColor ());
71+ }
72+
5973
6074}
0 commit comments