Code: Select all
@SuperBuilder
@Getter
@NoArgsConstructor
public class ExpenseDto {
@NonNull
@Size(max = 30)
protected String recipient;
@NonNull
@Size(max = 30)
protected String purpose;
// ...
protected boolean isInvoiced; // this somehow is changed
}
Code: Select all
@Data
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
public class ExpenseEntityDto extends ExpenseDto {
@Size(max = 16)
long expenseId;
@Size(max = 16)
@NonNull
protected String accountNo;
// ...
}
Code: Select all
public ExpenseEntityDto domainToEntityDto(Expense domain) {
return ExpenseEntityDto.builder()
.expenseId(domain.getExpenseId())
.accountNo(domain.getAccountNo())
.recipient(domain.getRecipient())
.purpose(domain.getPurpose())
.isInvoiced(domain.isInvoiced()) // produces a field 'invoiced' !?
.build();
}
Code: Select all
{
"recipient": "Mobsters Inc.",
"purpose": "protection services rendered",
"expenseId": 1,
"accountNo": "1234",
"invoiced": false // Huh !? expected 'isInvoiced' instead
}
Code: Select all
ExpenseEntityDto:
type: object
properties:
recipient:
maxLength: 30
type: string
purpose:
maxLength: 30
type: string
isInvoiced:
type: boolean
invoiced:
type: boolean
expenseId:
format: int64
type: integer
accountNo:
maxLength: 16
type: string