Search in sources :

Example 1 with Builder

use of uk.gov.gchq.gaffer.operation.impl.compare.Min.Builder in project Gaffer by gchq.

the class MinTest method builderShouldCreatePopulatedOperation.

@Test
@Override
public void builderShouldCreatePopulatedOperation() {
    // Given
    final Min min = new Builder().input(new Entity.Builder().group(TestGroups.ENTITY).property("property", 1).build(), new Entity.Builder().group(TestGroups.ENTITY).property("property", 2).build()).comparators(new ElementPropertyComparator() {

        @Override
        public int compare(final Element e1, final Element e2) {
            return 0;
        }
    }).build();
    // Then
    assertThat(min.getInput()).hasSize(2);
    List properties = Streams.toStream(min.getInput()).map(e -> e.getProperty("property")).collect(toList());
    assertThat(properties).containsOnly(1, 2);
}
Also used : Builder(uk.gov.gchq.gaffer.operation.impl.compare.Min.Builder) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) ElementPropertyComparator(uk.gov.gchq.gaffer.data.element.comparison.ElementPropertyComparator) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Set(java.util.Set) Entity(uk.gov.gchq.gaffer.data.element.Entity) Assertions.assertNotSame(org.junit.jupiter.api.Assertions.assertNotSame) Sets(com.google.common.collect.Sets) Element(uk.gov.gchq.gaffer.data.element.Element) Test(org.junit.jupiter.api.Test) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Streams(uk.gov.gchq.gaffer.commonutil.stream.Streams) TestGroups(uk.gov.gchq.gaffer.commonutil.TestGroups) Builder(uk.gov.gchq.gaffer.operation.impl.compare.Min.Builder) Element(uk.gov.gchq.gaffer.data.element.Element) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ElementPropertyComparator(uk.gov.gchq.gaffer.data.element.comparison.ElementPropertyComparator) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Aggregations

Sets (com.google.common.collect.Sets)1 List (java.util.List)1 Set (java.util.Set)1 Collectors.toList (java.util.stream.Collectors.toList)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertNotSame (org.junit.jupiter.api.Assertions.assertNotSame)1 Test (org.junit.jupiter.api.Test)1 TestGroups (uk.gov.gchq.gaffer.commonutil.TestGroups)1 Streams (uk.gov.gchq.gaffer.commonutil.stream.Streams)1 Element (uk.gov.gchq.gaffer.data.element.Element)1 Entity (uk.gov.gchq.gaffer.data.element.Entity)1 ElementPropertyComparator (uk.gov.gchq.gaffer.data.element.comparison.ElementPropertyComparator)1 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)1 Builder (uk.gov.gchq.gaffer.operation.impl.compare.Min.Builder)1