@Test
  public void shouldGetContents() throws Exception {
    StringContent stringContent = new StringContent(STRING_LANGUAGE, STRING_NAME, STRING_VALUE);
    StreamContent streamContent =
        new StreamContent(STREAM_LANGUAGE, STREAM_NAME, null, STREAM_CHECKSUM, STREAM_CONTENT_TYPE);
    GridSettings settings = createGridSettings("", true, true, "", 5, 1, "", "asc");
    List<ResourceDto> resourceDtos =
        asList(new ResourceDto(streamContent), new ResourceDto(stringContent));

    String expectedResponse = createResponse(new Resources(settings, resourceDtos));

    when(cmsLiteService.getAllContents()).thenReturn(asList(streamContent, stringContent));

    controller
        .perform(
            get(
                "/resource?name={name}&string={string}&stream={stream}&languages={languages}&rows={rows}&page={page}&sortColumn={sortColumn}&sortDirection={sortDirection}",
                "",
                true,
                true,
                "",
                5,
                1,
                "",
                "asc"))
        .andExpect(status().is(HttpStatus.OK.value()))
        .andExpect(content().type(APPLICATION_JSON_UTF8))
        .andExpect(content().string(jsonMatcher(expectedResponse)));

    verify(cmsLiteService).getAllContents();
  }
  @Test
  public void shouldReturnAllResourcesLanguages() throws Exception {
    StringContent stringContent = new StringContent(STRING_LANGUAGE, STRING_NAME, STRING_VALUE);
    StreamContent streamContent =
        new StreamContent(STREAM_LANGUAGE, STREAM_NAME, null, STREAM_CHECKSUM, STREAM_CONTENT_TYPE);

    when(cmsLiteService.getAllContents()).thenReturn(asList(streamContent, stringContent));

    Set<String> actual = resourceController.getAllLanguages();
    assertThat(actual, hasItems(STREAM_LANGUAGE, STRING_LANGUAGE));
  }
  @Test
  public void shouldReturnNamesStartedWithGivenTerm() throws Exception {
    StringContent stringContent = new StringContent(STRING_LANGUAGE, STRING_NAME, STRING_VALUE);
    StreamContent streamContent =
        new StreamContent(STREAM_LANGUAGE, STREAM_NAME, null, STREAM_CHECKSUM, STREAM_CONTENT_TYPE);
    String expectedResponse = createResponse(asList(STRING_NAME));

    when(cmsLiteService.getAllContents()).thenReturn(asList(streamContent, stringContent));

    controller
        .perform(get("/resource/available/{field}?term={term}", "name", "valid-stri"))
        .andExpect(status().is(HttpStatus.OK.value()))
        .andExpect(content().type(APPLICATION_JSON_UTF8))
        .andExpect(content().string(jsonMatcher(expectedResponse)));

    verify(cmsLiteService).getAllContents();
  }