/**
  * Tests the rendering of the form that edits a Reporter
  *
  * @throws java.lang.Exception
  */
 @Test
 public void testEditReporter() throws Exception {
   Reporter unedited = new Reporter(1L, "5 Reliance Cresc", "0423111234", "*****@*****.**");
   when(reporterServiceMock.find(1L)).thenReturn(unedited);
   mockMvc
       .perform(get("/reporters/1/edit"))
       .andExpect(status().isOk())
       .andExpect(view().name("/reporter/reporterForm"))
       .andExpect(model().attributeExists("reporter"))
       .andExpect(model().attribute("reporter", unedited));
 }
  /**
   * Tests the GET method for a Reporter
   *
   * @throws Exception
   */
  @Test
  public void testshowReporterProfile() throws Exception {
    // test data
    Reporter reporter = new Reporter(1L, "5 Reliance Cresc", "0423111234", "*****@*****.**");
    List<Item> reporterItems = createItemListForReporter(3);

    when(reporterServiceMock.find(1L)).thenReturn(reporter);
    when(itemServiceMock.findByReporter(reporter)).thenReturn(reporterItems);
    mockMvc
        .perform(get("/reporters/1"))
        .andExpect(status().isOk())
        .andExpect(view().name("/reporter/reporterProfile"))
        .andExpect(model().attributeExists("reporter"))
        .andExpect(model().attributeExists("itemList"))
        .andExpect(model().attribute("reporter", reporter))
        .andExpect(model().attribute("itemList", hasSize(3)))
        .andExpect(model().attribute("itemList", hasItems(reporterItems.toArray())));
  }