Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created June 21, 2023 20:09
Show Gist options
  • Save eliasnogueira/21ca0f6c083ced16959a2c890806c8af to your computer and use it in GitHub Desktop.
Save eliasnogueira/21ca0f6c083ced16959a2c890806c8af to your computer and use it in GitHub Desktop.
class MethodSourceCase2ExampleTest {
@DisplayName("Payment status")
@ParameterizedTest(name = "The payment with status {0} returns the message {1}")
@MethodSource("statusList")
void paymentStatus(Status status, String message) {
String auditedPayment = auditService.getPayments(status);
assertThat(status).isEqualTo(message);
}
static Stream<Arguments> statusList() {
return Stream.of(
Arguments.arguments(STATUS_PROCESSING, "The payment is being processed."),
Arguments.arguments(STATUS_PENDING, "The payment is pending."),
Arguments.arguments(STATUS_APPROVED, "The payment is approved."),
Arguments.arguments(STATUS_FAILED, "The payment failed.")
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment