@PrepareForTest(SampleServlet.class)
public class SampleServletTest {
@Test
public void doGet() throws Exception {
SampleServlet servlet = new SampleServlet();
HttpServletResponse response = createMock(HttpServletResponse.class);
PrintWriter writer = createMock(PrintWriter.class);
expect(response.getWriter()).andReturn(writer);
writer.write("out");
replay(response, writer);
servlet.doGet(null, response);
verify(response, writer);
}