1
- import org .junit .Before ;
2
- import org .junit .Test ;
1
+ import org .junit .jupiter .api .BeforeEach ;
2
+ import org .junit .jupiter .api .DisplayName ;
3
+ import org .junit .jupiter .api .Tag ;
4
+ import org .junit .jupiter .api .Test ;
3
5
4
6
import static org .assertj .core .api .Assertions .*;
5
7
@@ -8,63 +10,84 @@ public class SalaryCalculatorTest {
8
10
9
11
public SalaryCalculator calculator ;
10
12
11
-
12
- @ Before
13
+ @ BeforeEach
13
14
public void setUp () {
14
15
calculator = new SalaryCalculator ();
15
16
}
16
17
17
18
@ Test
19
+ @ Tag ("task:3" )
20
+ @ DisplayName ("The finalSalary method returns the regular salary without multiplier and bonus" )
18
21
public void regularSalary () {
19
22
assertThat (calculator .finalSalary (0 , 0 )).isEqualTo (1000.0 );
20
23
}
21
24
22
25
@ Test
26
+ @ Tag ("task:3" )
27
+ @ DisplayName ("The finalSalary method returns the correct result when daysSkipped below threshold" )
23
28
public void skippedBelowThreshold () {
24
29
assertThat (calculator .finalSalary (3 , 0 )).isEqualTo (1000.0 );
25
30
}
26
31
27
32
@ Test
33
+ @ Tag ("task:3" )
34
+ @ DisplayName ("The finalSalary method returns the correct result when daysSkipped above threshold" )
28
35
public void skippedAboveThreshold () {
29
36
assertThat (calculator .finalSalary (7 , 0 )).isEqualTo (850.0 );
30
37
}
31
38
32
39
@ Test
40
+ @ Tag ("task:3" )
41
+ @ DisplayName ("The finalSalary method returns the correct result when productsSold below threshold" )
33
42
public void soldBelowThreshold () {
34
43
assertThat (calculator .finalSalary (0 , 10 )).isEqualTo (1100.0 );
35
44
}
36
45
37
46
@ Test
47
+ @ Tag ("task:3" )
48
+ @ DisplayName ("The finalSalary method returns the correct result when productsSold above threshold" )
38
49
public void soldAboveThreshold () {
39
50
assertThat (calculator .finalSalary (0 , 25 )).isEqualTo (1325.0 );
40
51
}
41
52
42
53
@ Test
54
+ @ Tag ("task:3" )
55
+ @ DisplayName ("The finalSalary method returns the correct result when daysSkipped and productsSold below threshold" )
43
56
public void skippedBelowThresholdAndSoldBelowThreshold () {
44
57
assertThat (calculator .finalSalary (2 , 5 )).isEqualTo (1050.0 );
45
58
}
46
59
47
60
@ Test
61
+ @ Tag ("task:3" )
62
+ @ DisplayName ("finalSalary method returns correct result when daysSkipped below and productsSold above threshold" )
48
63
public void skippedBelowThresholdAndSoldAboveThreshold () {
49
64
assertThat (calculator .finalSalary (4 , 40 )).isEqualTo (1520.0 );
50
65
}
51
66
52
67
@ Test
68
+ @ Tag ("task:3" )
69
+ @ DisplayName ("finalSalary method returns correct result when daysSkipped above and productsSold below threshold" )
53
70
public void skippedAboveThresholdAndSoldBelowThreshold () {
54
71
assertThat (calculator .finalSalary (10 , 2 )).isEqualTo (870.0 );
55
72
}
56
73
57
74
@ Test
75
+ @ Tag ("task:3" )
76
+ @ DisplayName ("The finalSalary method returns the correct result when daysSkipped and productsSold above threshold" )
58
77
public void skippedAboveThresholdAndSoldAboveThreshold () {
59
78
assertThat (calculator .finalSalary (7 , 50 )).isEqualTo (1500.0 );
60
79
}
61
80
62
81
@ Test
82
+ @ Tag ("task:3" )
83
+ @ DisplayName ("The finalSalary method returns the correct result getting closer to the maximum" )
63
84
public void salaryCanReachCloseToMaximum () {
64
85
assertThat (calculator .finalSalary (0 , 76 )).isEqualTo (1988.0 );
65
86
}
66
87
67
88
@ Test
89
+ @ Tag ("task:3" )
90
+ @ DisplayName ("The finalSalary method returns the correct result capped at maximum salary" )
68
91
public void salaryRespectMaximum () {
69
92
assertThat (calculator .finalSalary (0 , 77 )).isEqualTo (2000.0 );
70
93
}
0 commit comments