### Question:
ShowContactsController extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Contact> contacts = addressBook.getAll(); request.setAttribute("contacts", contacts); request.getRequestDispatcher(viewPath).forward(request, response); }  GlobalAddressBook getAddressBook(); void setAddressBook(GlobalAddressBook addressBook);  }### Answer:
@Test public void testDoGet() throws ServletException, IOException { MockHttpServletRequest fakeRequest = new MockHttpServletRequest(); MockHttpServletResponse fakeResponse = new MockHttpServletResponse(); controller.doGet(fakeRequest, fakeResponse); assertSame(fakeRequest.getAttribute("contacts"), contactList); assertEquals("viewPath", fakeResponse.getForwardedUrl()); }