public void testAddTargetServiceItem() throws DuplicateKeyException {
   assertDatabaseEmpty();
   Target target = createTarget();
   TargetServiceItem tsi = getTargetServiceItem(target);
   hibernateTargetServiceItemDao.saveTargetServiceItem(tsi);
   assertEquals(1, hibernateTargetServiceItemDao.getAllTargetServiceItems().size());
 }
 private void saveTargetServiceItem(Target target) throws DuplicateKeyException {
   TargetServiceItem tsi = new TargetServiceItem();
   ServiceItem si = saveAndGetServiceItem("Solar Panel", "32000", 1);
   tsi.setAmount(si.getAmount());
   tsi.setServiceItem(si);
   tsi.setTarget(target);
   tsi.setServiceItemQty(1);
   hibernateTargetServiceItemDao.saveTargetServiceItem(tsi);
   assertEquals(1, hibernateTargetServiceItemDao.getAllTargetServiceItems().size());
 }