Last active
July 9, 2023 16:20
-
-
Save eliasnogueira/bdce4c4f30b04aed68368c1a4799c76e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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