www.tmar-test.com のインストール手順に従って、非常に基本的なテスト (算術和) を Jspresso アプリケーションに書きましたが、すべて問題ありませんでした。
2 番目のステップでは、より現実的なテストを作成し、Jspresso アプリケーションの一部であるメソッドを呼び出したいと思います。
メソッドを呼び出すためにテスト記述コンテキストを開始する必要がありますが、情報が不足しています。
私を助けるスニペットはありますか?
例として、Hrsample に基づいて、computeAge メソッドを呼び出す Tmar メソッドを提供できますか?
computeAge メソッドの下:
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;
}
}