}
@Test
@Transactional
public void testSetPercentageThreeHoursGroupIncrease() {
OrderLine orderLine = OrderLine.create();
HoursGroup hoursGroup = HoursGroup.create(orderLine);
hoursGroup.setWorkingHours(50);
HoursGroup hoursGroup2 = HoursGroup.create(orderLine);
hoursGroup2.setWorkingHours(150);
HoursGroup hoursGroup3 = HoursGroup.create(orderLine);
hoursGroup3.setWorkingHours(200);
orderLine.addHoursGroup(hoursGroup);
orderLine.addHoursGroup(hoursGroup2);
orderLine.addHoursGroup(hoursGroup3);
assertThat(orderLine.getWorkHours(), equalTo(400));
hoursGroup.setFixedPercentage(true);
hoursGroup.setPercentage(new BigDecimal(0.5).setScale(2));
orderLine.recalculateHoursGroups();
assertThat(orderLine.getWorkHours(), equalTo(400));
assertThat(orderLine.getHoursGroups().size(), equalTo(4));
assertThat(hoursGroup.getWorkingHours(), equalTo(200));
assertThat(hoursGroup2.getWorkingHours(), equalTo(85));
assertThat(hoursGroup3.getWorkingHours(), equalTo(114));
}