Search in sources :

Example 1 with ExpenseCategoryReferenceDto

use of ch.aaap.harvestclient.domain.reference.dto.ExpenseCategoryReferenceDto in project harvest-client by 3AP-AG.

the class ExpensesApiCreateTest method create.

@Test
void create() {
    Expense creationInfo = ImmutableExpense.builder().project(project).expenseCategory(expenseCategory).spentDate(LocalDate.now()).user(user).totalCost(22.).build();
    expense = expensesApi.create(creationInfo);
    assertThat(expense).usingComparatorForType(Comparator.comparing(Reference::getId), Reference.class).isEqualToIgnoringNullFields(creationInfo);
    ExpenseCategoryReferenceDto expenseCategoryDto = (ExpenseCategoryReferenceDto) expense.getExpenseCategory();
    ExpenseCategory expectedCategory = harvest.expenseCategories().get(expenseCategory);
    assertThat(expenseCategoryDto).isEqualToComparingOnlyGivenFields(expectedCategory, "unitName", "unitPrice");
}
Also used : ExpenseCategoryReferenceDto(ch.aaap.harvestclient.domain.reference.dto.ExpenseCategoryReferenceDto) Reference(ch.aaap.harvestclient.domain.reference.Reference) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

HarvestTest (ch.aaap.harvestclient.HarvestTest)1 Reference (ch.aaap.harvestclient.domain.reference.Reference)1 ExpenseCategoryReferenceDto (ch.aaap.harvestclient.domain.reference.dto.ExpenseCategoryReferenceDto)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1