Hi All,
I have a servlet and it has an inner class which has some methods inside it. The structure looks like this
public class ImageServlet extends AbstractImageServlet {
class ImageWrapper {
public Image getImage() {
final Image image;
if (name == null) {
image = new Image(resource);
} else {
image = new Image(resource, name); // getting null pointer exception here as even though I am trying to mock Image, unable to mock it properly.
}
return image;
}
}
@SuppressWarnings("deprecation")
@Override
protected void writeLayer(final SlingHttpServletRequest request, final SlingHttpServletResponse response,
final ImageContext context, final Layer layer) throws RepositoryException, IOException {
final Image image = wrapper.getImage();
}
}
Any pointers will help.