/**
   * Get a list of all clients
   *
   * @param modelAndView
   * @return
   */
  @RequestMapping(method = RequestMethod.GET, produces = "application/json")
  public String apiGetAllClients(Model model, Authentication auth) {

    Collection<ClientDetailsEntity> clients = clientService.getAllClients();
    model.addAttribute("entity", clients);

    if (isAdmin(auth)) {
      return "clientEntityViewAdmins";
    } else {
      return "clientEntityViewUsers";
    }
  }
  /**
   * Prepares a collection of ApprovedSite mocks to be returned from the approvedSiteService and a
   * collection of ClientDetailEntity mocks to be returned from the clientService.
   */
  @Before
  public void prepare() {

    Mockito.reset(approvedSiteService, clientService);

    Mockito.when(ap1.getUserId()).thenReturn(userId1);
    Mockito.when(ap1.getClientId()).thenReturn(clientId1);

    Mockito.when(ap2.getUserId()).thenReturn(userId1);
    Mockito.when(ap2.getClientId()).thenReturn(clientId1);

    Mockito.when(ap3.getUserId()).thenReturn(userId2);
    Mockito.when(ap3.getClientId()).thenReturn(clientId2);

    Mockito.when(ap4.getUserId()).thenReturn(userId2);
    Mockito.when(ap4.getClientId()).thenReturn(clientId3);

    Mockito.when(ap5.getUserId()).thenReturn(userId2);
    Mockito.when(ap5.getClientId()).thenReturn(clientId1);

    Mockito.when(ap6.getUserId()).thenReturn(userId1);
    Mockito.when(ap6.getClientId()).thenReturn(clientId4);

    Mockito.when(approvedSiteService.getAll()).thenReturn(Sets.newHashSet(ap1, ap2, ap3, ap4));

    Mockito.when(client1.getId()).thenReturn(1L);
    Mockito.when(client2.getId()).thenReturn(2L);
    Mockito.when(client3.getId()).thenReturn(3L);
    Mockito.when(client4.getId()).thenReturn(4L);

    Mockito.when(clientService.getAllClients())
        .thenReturn(Sets.newHashSet(client1, client2, client3, client4));
    Mockito.when(clientService.loadClientByClientId(clientId1)).thenReturn(client1);
    Mockito.when(clientService.loadClientByClientId(clientId2)).thenReturn(client2);
    Mockito.when(clientService.loadClientByClientId(clientId3)).thenReturn(client3);
    Mockito.when(clientService.loadClientByClientId(clientId4)).thenReturn(client4);
  }