@Test
  public void shouldReturnAll() {
    List<Content> contents = getContents();
    List<ResourceDto> expected = createInputData(contents);
    List<ResourceDto> actual =
        ResourceFilter.filter(createGridSettings("", true, true, ""), contents);

    assertEquals(expected, actual);
  }
  @Test
  public void shouldReturnEmptyList() {
    List<Content> contents = getContents();
    contents.add(new TestContent());

    List<ResourceDto> expected = new ArrayList<>();
    List<ResourceDto> actual =
        ResourceFilter.filter(createGridSettings("", false, false, ""), contents);

    assertNotNull(actual);
    assertEquals(expected, actual);
  }
  @Test
  public void shouldReturnOnlyWithGivenLanguages() {
    final Set<String> givenLanguages = new HashSet<>(asList("english", "spanish"));

    List<Content> contents = getContents();
    List<ResourceDto> expected = new ArrayList<>();
    expected.add(new ResourceDto("files-string-1", "string", "english"));
    expected.add(new ResourceDto("file-string-2", "string", "english", "spanish"));

    List<ResourceDto> actual =
        ResourceFilter.filter(createGridSettings("", true, true, "english,spanish"), contents);

    assertEquals(expected, actual);
  }
  @Test
  public void shouldReturnOnlyStreamResources() {
    List<Content> contents = getContents();
    List<ResourceDto> expected = createInputData(contents);

    CollectionUtils.filter(
        expected,
        new Predicate() {
          @Override
          public boolean evaluate(Object object) {
            return object instanceof ResourceDto
                && !equalsIgnoreCase(((ResourceDto) object).getType(), "string");
          }
        });

    List<ResourceDto> actual =
        ResourceFilter.filter(createGridSettings("", false, true, ""), contents);

    assertEquals(expected, actual);
  }
  @Test
  public void shouldReturnOnlyWithGivenName() {
    final String givenName = "files";

    List<Content> contents = getContents();
    List<ResourceDto> expected = createInputData(contents);

    CollectionUtils.filter(
        expected,
        new Predicate() {
          @Override
          public boolean evaluate(Object object) {
            return object instanceof ResourceDto
                && startsWithIgnoreCase(((ResourceDto) object).getName(), givenName);
          }
        });

    List<ResourceDto> actual =
        ResourceFilter.filter(createGridSettings(givenName, true, true, ""), contents);

    assertEquals(expected, actual);
  }