Created
November 9, 2020 17:27
-
-
Save eliasnogueira/89e32a0b94577dbdc7f76ff83bca6c69 to your computer and use it in GitHub Desktop.
Example of an Data Factory with hard-coded data inside each factory method
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
public class LoanDataFactory { | |
private LoanDataFactory() {} | |
public static Loan createLoan() { | |
return new LoanBuilder().name("Elias").email("elias@eliasnogueira.com") | |
.amount(new BigDecimal("10.000")).installments(8).build(); | |
} | |
public static Loan createLoanWithoutName() { | |
return new LoanBuilder().email("elias@eliasnogueira.com") | |
.amount(new BigDecimal("10.000")).installments(8).build(); | |
} | |
public static Loan createLoanWithNotValidEmail() { | |
return new LoanBuilder().name("Elias").email("not-valid-email") | |
.amount(new BigDecimal("10.000")).installments(8).build(); | |
} | |
public static Loan createLoanWithAmountLessThan() { | |
return new LoanBuilder().name("Elias").email("elias@eliasnogueira.com") | |
.amount(new BigDecimal("900.00")).installments(8).build(); | |
} | |
// other data factories ignored | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment