StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
Mockito.when(responseMock.getWriter()).thenReturn(out);
myServlet = new MyCoursesListServlet();
try {
myServlet.processRequest(requestMock, responseMock);
} catch (IOException ex) {
Logger.getLogger(LoginServletTest.class.getName()).log(Level.SEVERE, null, ex);
}