@Test
public void should_add_trust_anchor() throws Exception {

    ResultActions result = mvc.perform(
        post("/api/trust-anchors")
            .accept(ValidatorApi.API_MIME_TYPE)
            .contentType(ValidatorApi.API_MIME_TYPE)
            .content(objectMapper.writeValueAsString(ApiCommand.of(AddTrustAnchor.builder()
                .type(TrustAnchor.TYPE)
                .name(TEST_CA_NAME)
                .locations(Arrays.asList("rsync://example.com/rpki", "https://example.com/rpki"))
                .subjectPublicKeyInfo("jdfakljkldf;adsfjkdsfkl;nasdjfnsldajfklsd;ajfk;ljdsakjfkla;sdhfkjdshfkljadsl;kjfdklfjdaksl;jdfkl;jafkldjsfkl;adjsfkl;adjsf;lkjkl;dj;adskjfdljadjbkfbkjblafkjdfbasfjlka")
                .build()
            )))
    );
    result
        .andExpect(status().isCreated())
        .andExpect(content().contentType(ValidatorApi.API_MIME_TYPE));
    ApiResponse<TrustAnchorResource> response = addTrustAnchorResponse(result);
    assertThat(response.getData()).isNotNull();
    TrustAnchorResource resource = response.getData();
    Link selfRel = resource.getLinks().getLink("self");
    mvc.perform(
        get(selfRel.getHref())
            .accept(ValidatorApi.API_MIME_TYPE)
    )
        .andExpect(status().isOk())
        .andExpect(content().contentType(ValidatorApi.API_MIME_TYPE))
        .andExpect(jsonPath("$.data.name").value(TEST_CA_NAME));
}