### Question:
ShowContactsController extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Contact> contacts = addressBook.getAll(); request.setAttribute("contacts", contacts); }  GlobalAddressBook getAddressBook(); void setAddressBook(GlobalAddressBook addressBook);  }### Answer:
@Test public void testDoGet() throws ServletException, IOException { ShowContactsController controller = new ShowContactsController(); HttpServletRequest mockRequest = mock(HttpServletRequest.class); HttpServletResponse mockResponse = mock(HttpServletResponse.class); controller.doGet(mockRequest, mockResponse); verify(mockRequest, times(1)).setAttribute(anyString(), anyListOf(Contact.class)); }