Package org.martinlaw.util

Examples of org.martinlaw.util.TestUtils


  }

  @Test
  public void testToHtml() throws InstantiationException, IllegalAccessException {
    //use court case consideration
    TestUtils utils = new TestUtils();
    MatterConsideration csd = (MatterConsideration) utils.getTestConsideration();
    ConsiderationType type =  new ConsiderationType();
    final String considerationTypeName = "reserve";
    type.setName(considerationTypeName);
    csd.setConsiderationType(type);
    BigDecimal[] amounts = {new BigDecimal(450), new BigDecimal(640)};
    for (BigDecimal amount: amounts) {
      final MatterTransactionDoc testTransaction = (MatterTransactionDoc) utils.getMockTransaction(amount);
      csd.getTransactions().add(testTransaction);
    }
   
    String expected = "<b>" + considerationTypeName + "</b>:&nbsp;KES 2,090.00";
    assertEquals("consideration html differs", expected, csd.toHtml());
   
    csd = (MatterConsideration) utils.getTestConsideration();
    csd.setAmount(new BigDecimal(0));
    assertEquals("consideration html differs", "", csd.toHtml());
   
    csd = (MatterConsideration) utils.getTestConsideration();
    expected = "<b>" + considerationTypeName + "</b>:&nbsp;KES 1,000.00";
    csd.setConsiderationType(type);
    assertEquals("consideration html differs", expected, csd.toHtml());
  }
View Full Code Here


  public void testToIcalendar() throws IOException {
    // load template
    String template =IOUtils.toString(MatterEventTest.class.getResourceAsStream("vcalendar-template.txt"));
   
    // using court case date as matter date is abstract
    TestUtils utils = new TestUtils();
    MatterEvent caseDate = (MatterEvent) utils.getTestMatterEventForStringTemplates();
   
    String actualResult = caseDate.toIcalendar(template);
   
    // load expected result
    String expectedResult = IOUtils.toString(MatterEventTest.class.getResourceAsStream("vcalendar-expected-output.txt"));
View Full Code Here

  @Ignore("intend to rework notifications into sync/push")
  /**
   * tests {@link org.martinlaw.bo.MatterEvent#toNotificationXML(String, String, String, String)}
   */
  public void testToNotificationXML() throws IOException {
    TestUtils utils = new TestUtils();
    final String notificationXML = utils.getTestNotificationXml();
    String expected = IOUtils.toString(MatterEventTest.class.getResourceAsStream("event-notfn-expected.xml"));
    assertEquals("expected output differs", expected, notificationXML);
  }
View Full Code Here

   * @throws InstantiationException
   */
  @Test
  public void testToHtml() throws InstantiationException, IllegalAccessException {
    // use court case event as concrete class
    TestUtils utils = new TestUtils();
    MatterEvent event = utils.getTestMatterEventUnt(MatterEvent.class);
    SimpleDateFormat sdf = new SimpleDateFormat(MartinlawConstants.DEFAULT_TIMESTAMP_FORMAT);
    final String formattedDate = sdf.format(event.getStartDate());
   
    String expected = "<b>" + event.getType().getName() + "</b>:&nbsp;" + formattedDate + "<br/>" + event.getLocation();
    assertEquals("html output differs", expected, event.toHtml());
View Full Code Here

  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    utils = new TestUtils();
  }
View Full Code Here

   *
   * @return
   */
  public TestUtils getTestUtils() {
    if (testUtils == null) {
      testUtils = new TestUtils();
    }
    return testUtils;
  }
View Full Code Here

  @Test
  public void testSendEventNotification()
      throws RiceIllegalArgumentException, IOException {
        try {
          TestUtils utils = new TestUtils();
          // send notification
          final SendNotificationService sendNotificationService = (SendNotificationService) GlobalResourceLoader.getService(
              new QName(KenApiConstants.Namespaces.KEN_NAMESPACE_2_0, "sendNotificationService"));
          NotificationResponse response = sendNotificationService.invoke(utils.getTestNotificationXml());
     
          assertEquals("response status is not success", NotificationConstants.RESPONSE_STATUSES.SUCCESS, response.getStatus());
        } catch (Exception e) {
          log.error("exception occured", e);
          fail("exception occured");
View Full Code Here

   * Test method for {@link org.martinlaw.bo.MatterEventMaintainable#createNotificationMessage(String, String, org.martinlaw.bo.MatterEvent, String, String)}.
   * @throws IOException
   */
  @Test
  public void testCreateNotificationMessage() throws IOException {
    TestUtils utils = new TestUtils();
    MatterEventMaintainable eventMaint = new MatterEventMaintainable();
    String template = IOUtils.toString(MatterEventMaintainableTest.class.getResourceAsStream("notfn-msg-template.txt"));
    final String notificationMessage = eventMaint.createNotificationMessage(KRADConstants.MAINTENANCE_EDIT_ACTION, "1200",
        utils.getTestMatterEventForStringTemplates(), template, "http://localhost");
    String expected = IOUtils.toString(MatterEventMaintainableTest.class.getResourceAsStream("notfn-msg-expected.txt"));
    assertEquals("expected output differs", expected,
        notificationMessage);
  }
View Full Code Here

TOP

Related Classes of org.martinlaw.util.TestUtils

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.