我有以下课程
public class EmailManager{
protected String getEmailContent(String content,String image){
String result = content.toPrettyLook(); //this is an inner method
result+="<img src='" + +"' />";
return result;
}
protected String getImageLocation(String image){
//write image to disc
return newLocation;
}
}
public class EmailManagerTest{
EmailManager emailManager;
@Test
public void testEmailContent(){
String result = emailManager.getEmailContent("Hello World");
}
}
我应该在 EmailManager 上方添加什么注释?@Spy @Mock 还是 @Autowired?
如何告诉 Mockito 不要执行 getImageLocation (由 getEmailContent 调用的方法)并始终返回而不是“新位置”?我看了很多文章,对“when”“stub”“doReturn”感到困惑