Search in sources :

Example 56 with EntityId

use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.

the class FromEntityIdTest method shouldReturnNullIfTheInputIsNull.

@Test
public void shouldReturnNullIfTheInputIsNull() {
    // Given
    final EntityId input = null;
    final FromEntityId function = new FromEntityId();
    // When
    final Object output = function.apply(input);
    // Then
    assertNull(output);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Test(org.junit.jupiter.api.Test)

Example 57 with EntityId

use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.

the class ToEntityIdTest method shouldReturnNullIfTheInputIsNull.

@Test
public void shouldReturnNullIfTheInputIsNull() {
    // Given
    final Object input = null;
    final ToEntityId function = new ToEntityId();
    // When
    final EntityId output = function.apply(input);
    // Then
    assertNull(output);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Test(org.junit.jupiter.api.Test)

Example 58 with EntityId

use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.

the class ToEntityIdTest method shouldReturnOriginalValueIfInputIsAnEntity.

@Test
public void shouldReturnOriginalValueIfInputIsAnEntity() {
    // Given
    final Entity input = new Entity("group", "item");
    final ToEntityId function = new ToEntityId();
    // When
    final EntityId output = function.apply(input);
    // Then
    assertSame(input, output);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) Entity(uk.gov.gchq.gaffer.data.element.Entity) Test(org.junit.jupiter.api.Test)

Example 59 with EntityId

use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.

the class ToEntityIdTest method shouldReturnOriginalValueIfInputIsAnEntitySeed.

@Test
public void shouldReturnOriginalValueIfInputIsAnEntitySeed() {
    // Given
    final EntitySeed input = new EntitySeed("item");
    final ToEntityId function = new ToEntityId();
    // When
    final EntityId output = function.apply(input);
    // Then
    assertSame(input, output);
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) Test(org.junit.jupiter.api.Test)

Example 60 with EntityId

use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.

the class EntitySeedTest method shouldBeRelatedToEdgeIdWhenSourceAndVertexAreNull.

@Test
public void shouldBeRelatedToEdgeIdWhenSourceAndVertexAreNull() {
    // Given
    final String source = null;
    final String destination = "destination";
    final EntityId seed = new EntitySeed(destination);
    final EdgeId relatedSeed = mock(EdgeId.class);
    given(relatedSeed.getSource()).willReturn(source);
    given(relatedSeed.getDestination()).willReturn(destination);
    // Then
    assertTrue(seed.isRelated((ElementId) relatedSeed).isMatch());
}
Also used : EntityId(uk.gov.gchq.gaffer.data.element.id.EntityId) EdgeId(uk.gov.gchq.gaffer.data.element.id.EdgeId) JSONSerialisationTest(uk.gov.gchq.gaffer.JSONSerialisationTest) Test(org.junit.jupiter.api.Test)

Aggregations

EntityId (uk.gov.gchq.gaffer.data.element.id.EntityId)93 Test (org.junit.jupiter.api.Test)60 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)41 HashSet (java.util.HashSet)22 User (uk.gov.gchq.gaffer.user.User)21 JSONSerialisationTest (uk.gov.gchq.gaffer.JSONSerialisationTest)15 Entity (uk.gov.gchq.gaffer.data.element.Entity)15 EdgeId (uk.gov.gchq.gaffer.data.element.id.EdgeId)15 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)15 Edge (uk.gov.gchq.gaffer.data.element.Edge)14 Element (uk.gov.gchq.gaffer.data.element.Element)14 ElementId (uk.gov.gchq.gaffer.data.element.id.ElementId)14 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)13 GetAdjacentIds (uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds)13 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)12 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)10 ArrayList (java.util.ArrayList)8 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)7 Graph (uk.gov.gchq.gaffer.graph.Graph)7 Context (uk.gov.gchq.gaffer.store.Context)7