Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active December 3, 2023 17:43
Show Gist options
  • Save eliasnogueira/12cb6f9f064f308adac5185c6a44e7ff to your computer and use it in GitHub Desktop.
Save eliasnogueira/12cb6f9f064f308adac5185c6a44e7ff to your computer and use it in GitHub Desktop.
Example of a test validating the constants of Simulation
class SimulationTest {
@Test
void basicCheck() {
Simulation simulation = Simulation.builder().name("Elias").cpf("123456").email("[email protected]")
.amount(new BigDecimal(1000)).installments(48).insurance(false).build();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(simulation.getName()).isEqualTo("Elias");
softly.assertThat(simulation.getCpf()).isNotEmpty();
softly.assertThat(simulation.getEmail()).isEqualTo("[email protected]");
softly.assertThat(simulation.getAmount()).usingComparator(BigDecimal::compareTo).isBetween(new BigDecimal(1000), new BigDecimal(40000));
softly.assertThat(simulation.getInstallments()).isBetween(2, 48);
softly.assertThat(simulation.getInsurance()).isFalse();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment