/** * Test method for {@link * in.solpro.nucleus.apps.core.dbhelper.PartyAddressHelper#addPartyAddress(in.solpro.nucleus.apps.common.PartyAddress)}. */ public void testGetPartyAddresses() { List<PartyAddress> partyaddresses; try { PartyAddressHelper helper = new PartyAddressHelper(); PartyAddress partyaddress = new PartyAddress(); partyaddress.setContactperson("TEST PERSON"); partyaddress.setCity(city); partyaddress.setParty(party); partyaddress.setType(addresstype); helper.addPartyAddress(partyaddress); PartyAddress partyaddress1 = new PartyAddress(); partyaddress.setContactperson("TEST PERSON2"); partyaddress.setCity(city); partyaddress.setParty(party); partyaddress.setType(addresstype); helper.addPartyAddress(partyaddress1); partyaddresses = helper.getPartyAddresses(); if (partyaddresses == null) { fail(); } System.out.println("TAXES SIZE:" + partyaddresses.size()); for (int i = 0; i < partyaddresses.size(); i++) { partyaddresses.get(i).validateAndUpdate(); System.out.println( "PartyAddress name:" + partyaddresses.get(i).getContactperson() + "PartyAddress ID:" + partyaddresses.get(i).getId()); } } catch (Exception e) { System.out.print("error:"); } }
public void testDuplicatePartyAddress() { PartyAddress partyaddress = new PartyAddress(); partyaddress.setContactperson("TEST PERSON"); partyaddress.setAddress1("1"); partyaddress.setAddress2("1"); partyaddress.setAddress3("1"); partyaddress.setCity(city); partyaddress.setParty(party); partyaddress.setType(addresstype); PartyAddress partyaddress2 = new PartyAddress(); partyaddress2.setContactperson("TEST PERSON"); partyaddress2.setCity(city); partyaddress2.setAddress1("1"); partyaddress2.setAddress2("1"); partyaddress2.setAddress3("1"); partyaddress2.setParty(party); partyaddress2.setType(addresstype); PartyAddressHelper helper = new PartyAddressHelper(); try { helper.addPartyAddress(partyaddress); } catch (Exception e) { fail(); } try { helper.addPartyAddress(partyaddress2); fail(); } catch (Exception e) { } }
public void testgetPartyAddressById() throws Exception { PartyAddress partyaddress = new PartyAddress(); partyaddress.setContactperson("TEST PERSON"); partyaddress.setCity(city); partyaddress.setParty(party); partyaddress.setType(addresstype); PartyAddressHelper helper = new PartyAddressHelper(); helper.addPartyAddress(partyaddress); PartyAddress partyaddress1 = helper.getPartyAddress(partyaddress.getId()); if (partyaddress1 == null) { fail(); } partyaddress1.validateAndUpdate(); assertEquals(partyaddress1.getId(), partyaddress.getId()); }
public void testGetPartyAddress_DifferentCompany() { PartyAddress partyaddress = new PartyAddress(); PartyAddressHelper partyaddressHelper = new PartyAddressHelper(); partyaddress.setContactperson("TEST PERSON"); partyaddress.setCity(city); partyaddress.setParty(party); partyaddress.setType(addresstype); try { partyaddressHelper.addPartyAddress(partyaddress); assertNotNull(partyaddressHelper.getPartyAddress(partyaddress.getId())); SessionUtil.setCompany(companyNegTest); try { assertNull(partyaddressHelper.getPartyAddress(partyaddress.getId())); } catch (Exception e) { } SessionUtil.setCompany(company); } catch (Exception e) { fail(); } }