Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active July 9, 2023 16:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
class MethodSourceCase3ExampleTest {
@DisplayName("Unpronounceable entity tests")
@ParameterizedTest(name = "The Simulation {0} shows the error {1}")
@MethodSource("expensiveProducts")
void edgeCases(Simulation simulation, String errorMessage) {
Response response = postSimulation(simulation);
assertThat(response.statusCode).isEqualTo(422);
assertThat(response.body().errorMessage()).isEqualsTo(errorMessage);
}
static Stream<Arguments> edgeCases() {
Simulation installmentsMinValue = Simulation.builder().installments(1).build();
Simulation installmentsMaxValue = Simulation.builder().installments(41).build();
Simulation amountMinValue = Simulation.builder().amount(new BigDecimal("1.001")).build();
Simulation amountMinMax = Simulation.builder().amount(new BigDecimal("40.001")).build();
return Stream.of(
arguments(installmentsMinValue, "Installments must be less than or equal to 48"),
arguments(installmentsMaxValue, "Installments must be less than or equal to 48"),
arguments(amountMinMax, "Amount must be greater than or equal to 1.000"),
arguments(amountMinValue, "Amount must be greater less or equal to 40.000")
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment