0

Following the www.tmar-test.com installation procedure, I wrote a very basic test (arithmetic sum) in my Jspresso application and all is OK.

In a second step, I would like to write a more realistic test and call a method that is part of my Jspresso application.

I need to initiate the test description context in order to call the method, but I lack of information.

Do you have a snippet to help me ?

As example, based on Hrsample, could you provide a Tmar method calling the computeAge method ?

Below the computeAge method :

package org.jspresso.hrsample.model.service;
import java.util.Date;
import org.jspresso.hrsample.model.Employee;
import org.jspresso.framework.model.component.service.IComponentService;
/**
* The services delegate of the Employee entity
*/
public class EmployeeServiceDelegate implements IComponentService {
/**
* Computes the employee age.
*
* @param employee
* the employee this service execution has been triggered on.
* @param birthDate
* a birth date (might be different than the actual employee birth
* date).
* @return the age computed from the birth date passed as parameter.
*/
public Integer computeAge(Employee employee, Date birthDate) {
if (birthDate != null) {
return new Integer(
(int) ((new Date().getTime() - birthDate.getTime()) / (1000L * 60 * 60 * 24 * 365)));
}
return null;
}
}
Ygor
  • 35
  • 7

1 Answers1

1

Look this post at Jspresso.org which should help you.

  • I read your post and tried to implement a new test. But it fails because when I code the startup class I am not able to import : import org.jspresso.contrib.test.application.startup.AbstractTmar4JUnitBackendStartup. – Ygor Oct 08 '15 at 14:16