Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active July 9, 2023 16:20
Show Gist options
  • Save eliasnogueira/bdce4c4f30b04aed68368c1a4799c76e to your computer and use it in GitHub Desktop.
Save eliasnogueira/bdce4c4f30b04aed68368c1a4799c76e to your computer and use it in GitHub Desktop.
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