Test success and exceptions
Test the happy path and the error path.
Your task
Finish both verifiers so a wrong amount, a wrong message or a missing error all fail the test.
@IsTest
public class AS_ECE22D24B8C0_DiscountTests {
public static Decimal verifySuccess(Decimal amount, Decimal percent, Decimal expected) {
Decimal actual = AS_ECE22D24B8C0_Discount.apply(amount, percent);
return null;
}
public static String verifyRejected(Decimal amount, Decimal percent, String expectedMessage) {
return null;
}
@IsTest
static void validDiscount() {
verifySuccess(100, 15, 85.00);
}
}Requirements
- verifiesNormalResult should pass
- verifiesRoundedResult should pass
- verifiesRejectedInputs should pass
- catchesWrongAmount should pass
- catchesMissingError should pass
- catchesWrongMessage should pass