EasyMockが初めてです。私はEasyMockを使ってクラスをテストする必要がありますが、問題はクラスに内部クラスがあり、この内部クラスが外部クラスのメソッドにinstatiatedされ、いくつかのパラメータを渡して内部クラスのメソッドを呼び出すことです。私はこのクラスをどのようにテストするのか分かりません。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..
}
}