@Test
@Transactional
public void testSetWorkHoursTwoHoursGroupNoFixedIncreaseValue() {
OrderLine orderLine = OrderLine.create();
HoursGroup hoursGroup = HoursGroup.create(orderLine);
hoursGroup.setWorkingHours(100);
HoursGroup hoursGroup2 = HoursGroup.create(orderLine);
hoursGroup2.setWorkingHours(50);
orderLine.addHoursGroup(hoursGroup);
orderLine.addHoursGroup(hoursGroup2);
assertThat(orderLine.getWorkHours(), equalTo(150));
try {
orderLine.setWorkHours(200);
} catch (IllegalArgumentException e) {
fail("It should not throw an exception");
}
assertThat(orderLine.getWorkHours(), equalTo(200));
assertThat(orderLine.getHoursGroups().size(), equalTo(3));
assertThat(hoursGroup.getWorkingHours(), equalTo(133));
assertThat(hoursGroup2.getWorkingHours(), equalTo(66));
}