31
32
33
34
35
36
37
public class EmployeeBonusCalculatorTest {
@Test (expected IllegalArgumentException.class)
public void testInvalidYearsOfService() {
EmployeeBonusCalculator calculator = new EmployeeBonusCalculator();
calculator.calculateBonus (-1, 50000, true);
}
38
39
40
41
42
43
44
45
46
@Test
白
}
public void testYearsOfServiceGreaterThanTen () {
EmployeeBonusCalculator calculator = new EmployeeBonusCalculator();
double bonus calculator.calculateBonus (11, 50000, false);
assertEquals (5000.0, bonus, 0.01);
//add more code to complete the test
}
After completing the tests, students should provide a one-line summary for each test case and copy the test code into a Word document for evaluation.
Example:
ID: TC1; Test for
Input parameter:
; Expected result:
}
Zoom
Test code:
@Test
public void testNegativeX() {
assertThrows (IllegalArgumentException.class, () -> { numberProcessor.process Numbers(-1, 5, true);
});
100%
Close
Activate Wir
Go to Settings to