Hello experts, I would like to start the Junit/mockito etc test framework as I have seen lots of blogs and even here itself people are suggesting to write test cases instead of sysout and all.. but I have been really struggling with testing :-(.. I went through tutorials and most of tutorial shows example of doing tests of sum sum, divide, addition etc.. ok I understood that but how I can use it in real life programming. Can some one please guide me and help writing the test case for example below VOID method:
public void callHtmls(List<String> pathList, Session session, Image img){
Iterator<String> it = pathList.iterator();
while(it.hasNext()){
String path = it.next();
String htmlPath = getHtmlPath(path); // call to a method
if(htmlPath!=null){
System.out.println("HTML Path is = " + htmlPath);
try {
callImagePrinter(htmlPath,session, img); //again call to a method
}catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
}
Please help me!!!!! I am having a nightmare because of the testing :-(