Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created November 2, 2014 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfarcic/233a9ad7c864c3d8ff49 to your computer and use it in GitHub Desktop.
Save vfarcic/233a9ad7c864c3d8ff49 to your computer and use it in GitHub Desktop.
package com.technologyconversations.java8exercises.streams;
import org.junit.Test;
import java.util.List;
import static com.technologyconversations.java8exercises.streams.FilterCollection.*;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
/*
Filter collection so that only elements with less then 4 characters are returned.
*/
public class FilterCollectionSpec {
@Test
public void transformShouldFilterCollection() {
List<String> collection = asList("My", "name", "is", "John", "Doe");
List<String> expected = asList("My", "is", "Doe");
assertThat(transform(collection)).hasSameElementsAs(expected);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment