private TargetServiceItem getTargetServiceItem(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);
   return tsi;
 }
 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());
 }
 public void testUpdateTargetServiceItem() throws DuplicateKeyException {
   assertDatabaseEmpty();
   saveTargetServiceItem(createTarget());
   TargetServiceItem tsi = hibernateTargetServiceItemDao.getAllTargetServiceItems().get(0);
   assertEquals(
       1, hibernateTargetServiceItemDao.getAllTargetServiceItems().get(0).getServiceItemQty());
   tsi.setServiceItemQty(13);
   hibernateTargetServiceItemDao.updateTargetServiceItem(tsi);
   assertEquals(
       13, hibernateTargetServiceItemDao.getAllTargetServiceItems().get(0).getServiceItemQty());
 }