Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM Junits

Avatar

Level 1

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.

1 Accepted Solution

Avatar

Correct answer by
Employee
1 Reply

Avatar

Correct answer by
Employee