3
3
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
4
4
import static org .junit .jupiter .api .Assertions .*;
5
5
6
- import com .codedifferently .lesson16 .KimberleeObject .BrandsArray ;
7
6
import com .codedifferently .lesson16 .KimberleeObject .ConnectionNotFoundException ;
8
7
import com .codedifferently .lesson16 .KimberleeObject .HeadPhones ;
9
8
import com .codedifferently .lesson16 .KimberleeObject .HeadPhones .BoostMode ;
@@ -22,7 +21,7 @@ public void setUp() {
22
21
23
22
@ Test
24
23
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." );
26
25
assertEquals (
27
26
HeadPhoneColor .BLACK , headphones .getHeadPhoneColor (), "Color should be black by default." );
28
27
assertFalse (headphones .isPoweredOn (), "HeadPhones should be off by default." );
@@ -57,12 +56,12 @@ public void testIncreaseVolume() {
57
56
// Arrange
58
57
headphones .turnOn ();
59
58
headphones .increaseVolume ();
60
- assertEquals (1 , headphones .getVolume (0 ), "Volume should increase by 1" );
59
+ assertEquals (1 , headphones .getVolume (), "Volume should increase by 1" );
61
60
// Act
62
61
headphones .setVolume (99 );
63
62
headphones .increaseVolume ();
64
63
// Assert
65
- assertEquals (100 , headphones .getVolume (0 ), "Volume should not exceed 100." );
64
+ assertEquals (100 , headphones .getVolume (), "Volume should not exceed 100." );
66
65
}
67
66
68
67
@ Test
@@ -71,11 +70,11 @@ public void testDecreaseVolume() {
71
70
headphones .turnOn ();
72
71
headphones .setVolume (1 );
73
72
headphones .decreaseVolume ();
74
- assertEquals (0 , headphones .getVolume (0 ), "Volume should decrease to 0." );
73
+ assertEquals (0 , headphones .getVolume (), "Volume should decrease to 0." );
75
74
// Act
76
75
headphones .decreaseVolume ();
77
76
// 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." );
79
78
}
80
79
81
80
@ Test
@@ -92,19 +91,22 @@ public void testSetColor() {
92
91
@ Test
93
92
public void testPreferredBrand () {
94
93
// 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." );
98
94
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." );
101
104
}
102
105
103
106
@ Test
104
107
public void testwirelessConnection () throws Exception {
105
108
// Arrange
106
- headphones .isPoweredOn ();
107
- headphones .isWireless ();
109
+ headphones .turnOn ();
108
110
// Act
109
111
headphones .connectToBluetooth ();
110
112
// Assert
0 commit comments