Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created November 2, 2014 21:42
Show Gist options
  • Save vfarcic/046797e7a49d49c0970a to your computer and use it in GitHub Desktop.
Save vfarcic/046797e7a49d49c0970a 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.Kids.*;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
/*
Get names of all kids (under age of 18)
*/
public class KidsSpec {
@Test
public void getKidNameShouldReturnNamesOfAllKidsFromNorway() {
Person sara = new Person("Sara", 4);
Person viktor = new Person("Viktor", 40);
Person eva = new Person("Eva", 42);
Person anna = new Person("Anna", 5);
List<Person> collection = asList(sara, eva, viktor, anna);
assertThat(getKidNames(collection))
.contains("Sara", "Anna")
.doesNotContain("Viktor", "Eva");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment