@Test
  public void testTopVotedSuccess() {
    Long exoticRestaurantId = new Random().nextLong();
    Restaurant exoticRestaurant = createExoticRestaurant();
    exoticRestaurant.setRestaurantId(exoticRestaurantId);

    Long traditionalRestaurantId = new Random().nextLong();
    Restaurant traditionalRestaurant = createTraditionalRestaurant();
    traditionalRestaurant.setRestaurantId(traditionalRestaurantId);

    Voting voting1 = new Voting();
    voting1.setRestaurant(traditionalRestaurant);
    voting1.setUser("user1");

    Voting voting2 = new Voting();
    voting2.setRestaurant(traditionalRestaurant);
    voting2.setUser("user2");
    traditionalRestaurant.setVotings(Arrays.asList(voting1, voting2));

    Voting voting3 = new Voting();
    voting3.setRestaurant(exoticRestaurant);
    voting3.setUser("user3");
    exoticRestaurant.setVotings(Arrays.asList(voting3));
    when(votingRepository.findAll()).thenReturn(Arrays.asList(voting1, voting2, voting3));

    when(restaurantRepository.findOne(exoticRestaurantId)).thenReturn(exoticRestaurant);
    when(restaurantRepository.findOne(traditionalRestaurantId)).thenReturn(traditionalRestaurant);

    try {
      MvcResult topVotedRestaurantResponse =
          mockMvc.perform(get("/top")).andExpect(status().isOk()).andReturn();
      String responseContent = topVotedRestaurantResponse.getResponse().getContentAsString();
      assertTrue(responseContent.contains(Status.SUCCESS.getStatusValue()));
      assertTrue(responseContent.contains(traditionalRestaurant.getName()));
      assertTrue(responseContent.contains(voting1.getUser()));
      assertTrue(responseContent.contains(voting2.getUser()));
      assertFalse(responseContent.contains(exoticRestaurant.getName()));
      assertFalse(responseContent.contains(voting3.getUser()));
    } catch (Exception e) {
      fail();
    }
  }