@Test
@Transactional
public void testHourCostNotInTwoCategories() {
HourCost hourCost = createValidHourCost();
CostCategory costCategory1 = CostCategory.create(UUID.randomUUID().toString());
CostCategory costCategory2 = CostCategory.create(UUID.randomUUID().toString());
hourCost.setCategory(costCategory1);
hourCost.setCategory(costCategory2);
hourCostDAO.save(hourCost);
assertFalse(costCategory1.getHourCosts().contains(hourCost));
assertTrue(costCategory2.getHourCosts().contains(hourCost));
costCategory1.addHourCost(hourCost);
costCategory2.addHourCost(hourCost);
hourCostDAO.save(hourCost);
assertFalse(costCategory1.getHourCosts().contains(hourCost));
assertTrue(costCategory2.getHourCosts().contains(hourCost));
}