@Test
public void getLinks() throws Exception {

    Long operationsCount = linkRepository.count();
    final MockHttpSession httpSession = this.loginAsAdmin();
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    this.mockMvc.perform(post("/srv/api/records/links?uuid=" + this.uuid)
        .session(httpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().isCreated());
    Assert.assertEquals(1, linkRepository.count());
    this.mockMvc.perform(get("/srv/api/records/links")
        .session(httpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().isOk())
        .andExpect(content().contentType(API_JSON_EXPECTED_ENCODING))
        .andExpect(jsonPath("$.content", hasSize(1)))
        .andExpect(jsonPath("$.content[0].url").value(equalTo("http://services.sandre.eaufrance.fr/geo/ouvrage")))
        .andExpect(jsonPath("$.content[0].records", hasSize(1)))
        .andExpect(jsonPath("$.content[0].records[0].metadataId").value(equalTo(this.id)))
        .andExpect(jsonPath("$.content[0].records[0].metadataUuid").value(equalTo(md.getUuid())));;
    this.mockMvc.perform(delete("/srv/api/records/links")
        .session(httpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().isNoContent());
    Assert.assertEquals(0, linkRepository.count());
}