11import org .junit .Before ;
22import org .junit .Test ;
33import org .junit .Ignore ;
4-
5- import static org .junit .Assert .assertArrayEquals ;
6- import static org .junit .Assert .assertEquals ;
4+ import static org .assertj .core .api .Assertions .assertThat ;
75
86public class ResistorColorTest {
97
@@ -16,36 +14,26 @@ public void setup() {
1614
1715 @ Test
1816 public void testBlackColorCode () {
19- String input = "black" ;
20- int expected = 0 ;
21-
22- assertEquals (expected , resistorColor .colorCode (input ));
17+ assertThat (resistorColor .colorCode ("black" )).isEqualTo (0 );
2318 }
2419
2520 @ Ignore ("Remove to run test" )
2621 @ Test
2722 public void testWhiteColorCode () {
28- String input = "white" ;
29- int expected = 9 ;
30-
31- assertEquals (expected , resistorColor .colorCode (input ));
23+ assertThat (resistorColor .colorCode ("white" )).isEqualTo (9 );
3224 }
3325
3426 @ Ignore ("Remove to run test" )
3527 @ Test
3628 public void testOrangeColorCode () {
37- String input = "orange" ;
38- int expected = 3 ;
39-
40- assertEquals (expected , resistorColor .colorCode (input ));
29+ assertThat (resistorColor .colorCode ("orange" )).isEqualTo (3 );
4130 }
4231
4332 @ Ignore ("Remove to run test" )
4433 @ Test
4534 public void testColors () {
46- String [] expected = { "black" , "brown" , "red" , "orange" , "yellow" , "green" , "blue" , "violet" , "grey" , "white" };
47-
48- assertArrayEquals ( expected , resistorColor . colors () );
35+ assertThat ( resistorColor . colors ()). containsExactly (
36+ "black" , "brown" , "red" , "orange" , "yellow" , "green" , "blue" , "violet" , "grey" , "white"
37+ );
4938 }
50-
5139}
0 commit comments