33import static org .assertj .core .api .Assertions .assertThatThrownBy ;
44import static org .junit .jupiter .api .Assertions .*;
55
6- import com .codedifferently .lesson16 .KimberleeObject .BrandsArray ;
76import com .codedifferently .lesson16 .KimberleeObject .ConnectionNotFoundException ;
87import com .codedifferently .lesson16 .KimberleeObject .HeadPhones ;
98import com .codedifferently .lesson16 .KimberleeObject .HeadPhones .BoostMode ;
@@ -22,7 +21,7 @@ public void setUp() {
2221
2322 @ Test
2423 public void testDefaultState () {
25- assertEquals (0 , headphones .getVolume (0 ), "Volume should be 0 by default." );
24+ assertEquals (0 , headphones .getVolume (), "Volume should be 0 by default." );
2625 assertEquals (
2726 HeadPhoneColor .BLACK , headphones .getHeadPhoneColor (), "Color should be black by default." );
2827 assertFalse (headphones .isPoweredOn (), "HeadPhones should be off by default." );
@@ -57,12 +56,12 @@ public void testIncreaseVolume() {
5756 // Arrange
5857 headphones .turnOn ();
5958 headphones .increaseVolume ();
60- assertEquals (1 , headphones .getVolume (0 ), "Volume should increase by 1" );
59+ assertEquals (1 , headphones .getVolume (), "Volume should increase by 1" );
6160 // Act
6261 headphones .setVolume (99 );
6362 headphones .increaseVolume ();
6463 // Assert
65- assertEquals (100 , headphones .getVolume (0 ), "Volume should not exceed 100." );
64+ assertEquals (100 , headphones .getVolume (), "Volume should not exceed 100." );
6665 }
6766
6867 @ Test
@@ -71,11 +70,11 @@ public void testDecreaseVolume() {
7170 headphones .turnOn ();
7271 headphones .setVolume (1 );
7372 headphones .decreaseVolume ();
74- assertEquals (0 , headphones .getVolume (0 ), "Volume should decrease to 0." );
73+ assertEquals (0 , headphones .getVolume (), "Volume should decrease to 0." );
7574 // Act
7675 headphones .decreaseVolume ();
7776 // Assert
78- assertEquals (0 , headphones .getVolume (0 ), "Volume should not go lower than 0." );
77+ assertEquals (0 , headphones .getVolume (), "Volume should not go lower than 0." );
7978 }
8079
8180 @ Test
@@ -92,19 +91,22 @@ public void testSetColor() {
9291 @ Test
9392 public void testPreferredBrand () {
9493 // Assert
95- assertTrue (BrandsArray .isPreferredBrand ("Beats" ), "Beats should be a preferred brand." );
96- assertTrue (BrandsArray .isPreferredBrand ("Sony" ), "Sony should be a preferred brand." );
97- assertFalse (BrandsArray .isPreferredBrand ("Apple" ), "Apple should not be a preferred brand." );
9894 assertTrue (
99- BrandsArray .isPreferredBrand ("SkullCandy" ), "SkullCandy should be a preferred brand." );
100- assertTrue (BrandsArray .isPreferredBrand ("Juicy" ), "Juicy should be a preferred brand." );
95+ HeadPhones .BrandUtils .isPreferredBrand ("Beats" ), "Beats should be a preferred brand." );
96+ assertTrue (HeadPhones .BrandUtils .isPreferredBrand ("Sony" ), "Sony should be a preferred brand." );
97+ assertFalse (
98+ HeadPhones .BrandUtils .isPreferredBrand ("Apple" ), "Apple should not be a preferred brand." );
99+ assertTrue (
100+ HeadPhones .BrandUtils .isPreferredBrand ("SkullCandy" ),
101+ "SkullCandy should be a preferred brand." );
102+ assertTrue (
103+ HeadPhones .BrandUtils .isPreferredBrand ("Juicy" ), "Juicy should be a preferred brand." );
101104 }
102105
103106 @ Test
104107 public void testwirelessConnection () throws Exception {
105108 // Arrange
106- headphones .isPoweredOn ();
107- headphones .isWireless ();
109+ headphones .turnOn ();
108110 // Act
109111 headphones .connectToBluetooth ();
110112 // Assert
0 commit comments