Package org.martinlaw.bo.contract

Examples of org.martinlaw.bo.contract.Contract


  @Test(expected = DataIntegrityViolationException.class)
  /**
   * tests that non nullable fields are checked
   */
  public void testContractTypeNullableFields() {
    Contract contract = new Contract();
    getBoSvc().save(contract);
  }
View Full Code Here


  /**
   * tests retrieving from date inserted via sql
   */
  public void testContractRetrieve() {
    // retrieve object populated via sql script
    Contract contract = getBoSvc().findBySinglePrimaryKey(Contract.class, 1005l);
    assertNotNull("contract should exist in database", contract);
    assertEquals("contract name not the expected value", "buru ph2 h24", contract.getName());
    assertNotNull("matter type should not be null", contract.getType());
    assertEquals("matter type name does not match", "rent agreement", contract.getType().getName());
    assertNotNull("contract duration should not be null" ,contract.getContractDuration());
    assertNotNull("contract duration start date should not be null", contract.getContractDuration().getStartDate());
    assertNotNull("contract duration end date should not be null", contract.getContractDuration().getEndDate());
    assertNotNull("client principal name should not be null", contract.getClientPrincipalName());
    getTestUtils().testMatterClient(contract, "Client");
    // assignees
    assertNotNull("assignees should not be null", contract.getAssignees());
    assertEquals("number of assignees differs", 1, contract.getAssignees().size());
    assertEquals("assignee name differs", "alice_wanjiru", contract.getAssignees().get(0).getPrincipalName());
   
    getTestUtils().testRetrievedConsiderationFields(contract.getConsiderations().get(0));
   
    getTestUtils().testWorkList(contract.getWork());
    getTestUtils().testMatterClient(contract, "Client");
  }
View Full Code Here

  /**
   * test CRUD for {@link Contract}
   */
  public void testContractCRUD() {
    // C
    Contract contract = getTestUtils().getTestContract();
    try {
      /*List<Consideration> considerations = new ArrayList<Consideration>();
      considerations.add((Consideration) getTestUtils().getTestConsideration(Consideration.class));
      contract.setConsiderations(considerations);*/
    } catch (Exception e) {
      fail("could not add consideration");
      log.error(e);
    }
   
    getBoSvc().save(contract);
    // R
    contract.refresh();
    getTestUtils().testContractFields(contract);
    assertNotNull("considerations should not be null", contract.getConsiderations());
    assertEquals("default number of considerations differs", 2, contract.getConsiderations().size());
    assertNotNull("client object should not be null", contract.getClient());
    assertNotNull("client principal name should not be null", contract.getClientPrincipalName());
    // U
    String serviceOffered = "flat 3f2";
    contract.setServiceOffered(serviceOffered);
    contract.refresh();
    assertEquals("contract svc offered does not match after update", serviceOffered, contract.getServiceOffered());
    // D
    getBoSvc().delete(contract);
    assertNull("contract should not exist", getBoSvc().findBySinglePrimaryKey(Contract.class, contract.getId()));
    // the two default considerations should have been deleted
    assertNull("consideration should not exist", getBoSvc().findBySinglePrimaryKey(
        MatterConsideration.class, contract.getConsiderations().get(0).getId()));
    assertNull("consideration should not exist", getBoSvc().findBySinglePrimaryKey(
        MatterConsideration.class, contract.getConsiderations().get(1).getId()));
    assertNull("duration should not exist", getBoSvc().findBySinglePrimaryKey(ContractDuration.class, contract.getId()));
   
    Map<String, Object> criteria = new HashMap<String, Object>();
    criteria.put("contractId", contract.getId());
    assertEquals("contract signatories should have been deleted", 0, getBoSvc().findMatching(ContractSignatory.class, criteria).size());
    assertEquals("contract parties should have been deleted", 0, getBoSvc().findMatching(ContractParty.class, criteria).size());
   
  }
View Full Code Here

  @Test
  /**
   * test that ContractMaintenanceDocument routes to clerk then lawyer on submit
   */
  public void testContractRouting() {
    Contract testContract = getTestUtils().getTestContract();
    try {
      testMaintenanceRoutingInitToFinal(getDocTypeName(), testContract);
    } catch (Exception e) {
      log.error("test failed", e);
      fail("test routing ContractMaintenanceDocument caused an exception " + e);
View Full Code Here

  @Test
  /**
   * test ContractMaintenanceDocument doc search
   */
  public void testContractDocSearch() throws WorkflowException, InstantiationException, IllegalAccessException {
    Contract testContract = getTestUtils().getTestContract();
    final String docType = getDocTypeName();
    testMaintenanceRoutingInitToFinal(docType, testContract);
   
    Contract testContract2 = getTestUtils().getTestContract();
    testContract2.setName("salary and terms for temporary dev");
    testContract2.setLocalReference("MY/FIRM/CONTRACTS/2013/27");
    testMaintenanceRoutingInitToFinal(docType, testContract2);
   
    Contract testContract3 = getTestUtils().getTestContract();
    testContract3.setName("supply of veges");
    testContract3.setClientPrincipalName("Patrick Kamau");
    testContract3.setLocalReference("MY/FIRM/CONTRACTS/2013/21");
    testContract3.getConsiderations().add(getTestUtils().getTestConsideration());
    testMaintenanceRoutingInitToFinal(docType, testContract3);
   
    // no document criteria given, so both documents should be found
    SearchTestCriteria crit1 = new SearchTestCriteria();
    crit1.setExpectedDocuments(3);
View Full Code Here

   * @return the unpersisted contract
   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  public Contract getTestContract()  {
    Contract contract = new Contract();
    contract.setName(contractName);
    contract.setLocalReference(testContractLocalReference);
    contract.setTypeId(10006l);
    contract.setSummaryOfTerms("see attached file");
    contract.setServiceOffered("flat 1f2");
    contract.setStatusId(10033l);
    contract.setClientPrincipalName("Alice Wanjiru");
    // parties
    List<ContractParty> parties = new ArrayList<ContractParty>();
    parties.add(new ContractParty("Charity Mumbi"));
    parties.add(new ContractParty("Kevin Ngatia"));
    contract.setParties(parties);
    // signatories
    List<ContractSignatory> signs = new ArrayList<ContractSignatory>();
    signs.add(new ContractSignatory("Myles Mathenge"));
    signs.add(new ContractSignatory("Zeph Njogu"));
    contract.setSignatories(signs);
    // consideration - use default considerations
    /*try {
      contract.getConsiderations().add((Consideration) getTestConsideration(Consideration.class));
    } catch (Exception e) {
      //fail("could not add consideration");
      log.error(e);
    }*/
    // duration
    Calendar cal = Calendar.getInstance();
    Date start = new Date(cal.getTimeInMillis());
    cal.roll(Calendar.YEAR, true);
    Date end = new Date(cal.getTimeInMillis());
    ContractDuration contractDuration = new ContractDuration(start, end);

    contract.setContractDuration(contractDuration);
   
    return contract;
  }
View Full Code Here

    when(newMaintainableObject.getDataObject()).thenReturn(new LandCase());
    comment = String.format(commentTemplate, expectedLandCaseScopeCount, dataObjectName, "land case", expectedEmptyScopeCount);
    assertEquals(comment, expectedLandCaseScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
   
    comment = String.format(commentTemplate, expectedContractScopeCount, dataObjectName, "contract", expectedEmptyScopeCount);
    when(newMaintainableObject.getDataObject()).thenReturn(new Contract());
    assertEquals(comment, expectedContractScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
   
    comment = String.format(commentTemplate, expectedMatterScopeCount, dataObjectName, "matter", expectedEmptyScopeCount);
    when(newMaintainableObject.getDataObject()).thenReturn(new Matter());
    assertEquals(comment, expectedMatterScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
View Full Code Here

TOP

Related Classes of org.martinlaw.bo.contract.Contract

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.