我是EasyMock的新手。我需要使用EasyMock來測試我的類,但是這裏的問題是我的類有內部類,並且此內部類在外部類的方法中已經創建,並通過傳遞一些參數來調用內部類的方法。我不知道如何測試這個類。如何使用EasyMock測試內部類別
下面是一些示例代碼。
Any help or suggetions are highly appreciated.
public class ServiceClass implements ServiceInterface {
public void updateUSer(USer) {
//some logic over here.
sendEmailNotice(subject, vTemplate);
}
private sendEmailNotice(subject, vTemplate) {
MimeMessagePrepator eNotice = new PrepareEmailNotice(subject, vTemplate);
MailSender.send(eNotice);
}
public class PrepareEmailNotice implements MimeMessagePrepator {
// some local variables.
public PrepareEmailNotice(subject, vTemplate) {
subject = subject;
vTemplate = vTemplate;
}
public void prepare(MimeMessage message) {
MimeMessageHealper helper = new MimeMessageHealper(message, true);
// setting the mail properties like subject, to address, etc..
}
}