Files
spring-boot-rest/libraries/src/test/java/com/baeldung/eclipsecollections/CollectPatternTest.java
Eugen Paraschiv d2a2a65566 cleanup work
2018-03-04 17:39:09 +02:00

23 lines
677 B
Java

package com.baeldung.eclipsecollections;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.list.mutable.FastList;
import org.assertj.core.api.Assertions;
import org.junit.Test;
public class CollectPatternTest {
@Test
public void whenCollect_thenCorrect() {
Student student1 = new Student("John", "Hopkins");
Student student2 = new Student("George", "Adams");
MutableList<Student> students = FastList.newListWith(student1, student2);
MutableList<String> lastNames = students.collect(Student::getLastName);
Assertions.assertThat(lastNames).containsExactly("Hopkins", "Adams");
}
}