1
1
package com .codedifferently .lesson16 .xaviercruz ;
2
2
3
- import static org .junit .jupiter .api .Assertions .assertEquals ;
4
- import static org .junit .jupiter .api .Assertions .assertThrows ;
5
-
6
3
import java .util .ArrayList ;
7
4
import java .util .Arrays ;
8
5
6
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
7
+ import static org .junit .jupiter .api .Assertions .assertThrows ;
9
8
import org .junit .jupiter .api .Test ;
10
9
11
10
public class PersonTest {
@@ -16,6 +15,12 @@ public void testGetName(){
16
15
assertEquals ("That one guy right there" , person .getName ());
17
16
}
18
17
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
+
19
24
@ Test
20
25
public void testGetAge (){
21
26
assertEquals (25 , person .getAge ());
@@ -49,12 +54,21 @@ public void testUpdateAge(){
49
54
}
50
55
51
56
@ Test
52
- public void testAddToTraits_Exception () throws TooManyTraitsException {
57
+ public void testAddToTraits_Exception (){
53
58
String [] newTraits = new String []{"test" , "test" , "test" , "test" , "test" , "test" , "test" };
54
59
assertThrows (TooManyTraitsException .class , () -> {
55
60
person .addToTraits (newTraits );
56
61
});
57
62
}
58
63
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
+
59
73
60
74
}
0 commit comments