use of org.estatio.module.budget.dom.budgetitem.BudgetItemValue in project estatio by estatio.
the class BudgetItemValueRepository_IntegTest method findUniqueTest.
@Test
public void findUniqueTest() {
// given
Property property = Property_enum.OxfGb.findUsing(serviceRegistry);
Budget budget = budgetRepository.findByPropertyAndStartDate(property, new LocalDate(2015, 01, 01));
BudgetItem budgetItem = budget.getItems().first();
// when
BudgetItemValue result = budgetItemValueRepository.findUnique(budgetItem, new LocalDate(2015, 01, 01), BudgetCalculationType.BUDGETED);
// then
assertThat(result.getDate()).isEqualTo(new LocalDate(2015, 01, 01));
// and when
result = budgetItemValueRepository.findUnique(budgetItem, new LocalDate(2015, 01, 02), BudgetCalculationType.BUDGETED);
// then
assertThat(result).isNull();
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItemValue in project estatio by estatio.
the class BudgetItemValueRepository_IntegTest method updateOrCreateTest_Update.
@Test
public void updateOrCreateTest_Update() {
// given
LocalDate budgetStart = new LocalDate(2015, 01, 01);
Property property = Property_enum.OxfGb.findUsing(serviceRegistry);
Budget budget = budgetRepository.findByPropertyAndStartDate(property, budgetStart);
BudgetItem budgetItem = budget.getItems().first();
assertThat(budgetItem.getValues().size()).isEqualTo(1);
assertThat(budgetItem.getValues().first().getType()).isEqualTo(BudgetCalculationType.BUDGETED);
assertThat(budgetItem.getValues().first().getValue()).isEqualTo(new BigDecimal("30000.55"));
// when
BudgetItemValue result = wrap(budgetItemValueRepository).updateOrCreateBudgetItemValue(new BigDecimal("33333.00"), budgetItem, budgetStart, BudgetCalculationType.BUDGETED);
// then
assertThat(budgetItem.getValues().size()).isEqualTo(1);
assertThat(result.getValue()).isEqualTo(new BigDecimal("33333.00"));
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItemValue in project estatio by estatio.
the class BudgetItemValueRepository_IntegTest method updateOrCreateTest_Create.
@Test
public void updateOrCreateTest_Create() {
// given
LocalDate budgetStart = new LocalDate(2015, 1, 1);
Property property = Property_enum.OxfGb.findUsing(serviceRegistry);
Budget budget = budgetRepository.findByPropertyAndStartDate(property, budgetStart);
BudgetItem budgetItem = budget.getItems().first();
assertThat(budgetItem.getValues().size()).isEqualTo(1);
assertThat(budgetItem.getValues().first().getType()).isEqualTo(BudgetCalculationType.BUDGETED);
assertThat(budgetItem.getValues().first().getValue()).isEqualTo(new BigDecimal("30000.55"));
// when
BudgetItemValue result = wrap(budgetItemValueRepository).updateOrCreateBudgetItemValue(new BigDecimal("33333.00"), budgetItem, budgetStart, BudgetCalculationType.ACTUAL);
transactionService.flushTransaction();
// then
assertThat(budgetItem.getValues().size()).isEqualTo(2);
assertThat(result.getValue()).isEqualTo(new BigDecimal("33333.00"));
assertThat(result.getType()).isEqualTo(BudgetCalculationType.ACTUAL);
}
use of org.estatio.module.budget.dom.budgetitem.BudgetItemValue in project estatio by estatio.
the class BudgetItemValueRepository_IntegTest method findByBudgetItemAndType.
@Test
public void findByBudgetItemAndType() {
// given
Property property = Property_enum.OxfGb.findUsing(serviceRegistry);
Budget budget = budgetRepository.findByPropertyAndStartDate(property, new LocalDate(2015, 01, 01));
BudgetItem budgetItem = budget.getItems().first();
assertThat(budgetItem.getValues().size()).isEqualTo(1);
assertThat(budgetItem.getValues().first().getType()).isEqualTo(BudgetCalculationType.BUDGETED);
// when
List<BudgetItemValue> results = budgetItemValueRepository.findByBudgetItemAndType(budgetItem, BudgetCalculationType.BUDGETED);
// then
assertThat(results.size()).isEqualTo(1);
}
Aggregations