1
1
package com .codedifferently .lesson16 ;
2
2
3
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
3
5
import static org .assertj .core .api .Assertions .assertThat ;
4
6
5
7
import org .junit .jupiter .api .Test ;
8
+ import java .util .ArrayList ;
9
+ import java .util .List ;
6
10
7
11
class CoinTest {
8
12
9
- @ test
10
- void testCheckCoininPocket (){
13
+ @ Test
14
+ void testCheckCoinInPocket (){
11
15
//arrange
12
- Coins coin = new Coin (to fill in );
13
-
16
+ Coins coin = new Coin (Coins .CoinType .NICKEL , 5 , false , 5.0 , 1966 , new ArrayList <>(nickel ,copper ));
14
17
//act action
15
- CoinType actualCoin = CoinType .nickel ;
18
+ CoinType actualCoin = CoinType .NICKEL ;
16
19
17
20
//assert
18
- assertEquals (nickel ,coins .checkCoinType ())
21
+ assertEquals (CoinType . NICKEL ,coins .checkCoinType ())
19
22
}
20
- @ test
21
- void testWeighCoins (){
23
+ @ Test
24
+ void testWeighCoins (){
22
25
//arrange
23
- Coins coin = new Coin (to fill in );
24
- double expectedWeight = 5.0 ;
26
+ Coins coin = new Coin (Coins . CoinType . NICKEL , 5 , false , 5.0 , 1966 , new ArrayList <>( nickel , copper ) );
27
+ double expectedWeight = 5.0 ;
25
28
//act
26
- double coinWeight = coin .coinGramWeight ();
29
+ double coinWeight = coin .coinGramWeight ();
27
30
//assert
28
- assertEquals (expected , coinweight );
31
+ assertEquals (expected , coinWeight );
29
32
}
30
- @ test
31
- void testConvertCoins (){
33
+ @ Test
34
+ void testConvertCoins (){
32
35
//arrange
33
- coinCollection = new Arraylist <>();
34
- Coin nickel1 = new coin ();
35
- Coin nickel2 = new coin ();
36
- coinCollection .add (nickel1 );
37
- coinCollection .add (nickel2 );
36
+ coinCollection = new Arraylist <>();
37
+ Coin nickel1 = new Coin ();
38
+ Coin nickel2 = new coin ();
39
+ coinCollection .add (nickel1 );
40
+ coinCollection .add (nickel2 );
38
41
39
42
//act
40
- Coin Dime = Coin .convertNickelsToDime ();
43
+ Coin Dime = Coin .convertNickelsToDime (nickel1 , nickel2 );
41
44
//assert
42
- Assert (10 , Dime .getValue ())
45
+ Assert (10 , Dime .getValue ())
43
46
}
44
47
@ Test
45
- void testCollectCoins (){
48
+ void testCollectCoins (){
46
49
//arrange
47
- coinCollection = new Arraylist <>();
48
- Coin penny = new coin ();
49
- Coin nickel = new coin ();
50
- Coin dime = new coin ();
51
- add coins to coin collection
50
+ coinCollection = new Arraylist <>();
51
+ Coin penny = new Coin ();
52
+ Coin nickel = new Coin ();
53
+ Coin dime = new Coin ();
52
54
//act
53
- AddCoin (penny );
54
- AddCoin (nickel );
55
- AddCoin (dime );
55
+ AddCoin (penny );
56
+ AddCoin (nickel );
57
+ AddCoin (dime );
56
58
//assert
57
- AssertEquals (3 ,coinCollection ());
59
+ AssertEquals (3 ,coinCollection ());
58
60
}
59
- @ test
60
- void testGetAgeCoin (){
61
+ @ Test
62
+ void testGetAgeCoin (){
61
63
//arrange
62
- Coin coin = new coin ();
64
+ Coin coin = new Coin ();
63
65
// Act
64
66
int age = coin .geCoinAge ();
65
67
// Assert
66
- assertEquals (1954 , actual );
68
+ assertEquals (1954 , age );
67
69
}
68
- }
70
+ @ Test
71
+ void testGetMaterialComposition (){
72
+ Coin Penny = new Coin (new Arraylist <>(Array .asList ("copper,zinc" )))
73
+
74
+ }
75
+ }
0 commit comments