use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class EdgeSeedTest method shouldNotBeRelatedToEntityIdWhenIdentifierNotEqualToSourceOrDestination.
@Test
public void shouldNotBeRelatedToEntityIdWhenIdentifierNotEqualToSourceOrDestination() {
// Given
final String source = "source";
final String destination = "destination";
final boolean directed = true;
final EdgeId seed = new EdgeSeed(source, destination, directed);
final EntityId unrelatedSeed = mock(EntityId.class);
given(unrelatedSeed.getVertex()).willReturn("other identifier");
// When
final boolean isRelated = seed.isRelated((ElementId) unrelatedSeed).isMatch();
// Then
assertFalse(isRelated);
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class EdgeSeedTest method shouldBeRelatedToEntityIdWhenDestinationEqualsVertex.
@Test
public void shouldBeRelatedToEntityIdWhenDestinationEqualsVertex() {
// Given
final String source = "source";
final String destination = "destination";
final boolean directed = true;
final EdgeId seed = new EdgeSeed(source, destination, directed);
final EntityId relatedSeed = mock(EntityId.class);
given(relatedSeed.getVertex()).willReturn(destination);
// When
final boolean isRelated = seed.isRelated((ElementId) relatedSeed).isMatch();
// Then
assertTrue(isRelated);
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class EntityIdExtractorTest method shouldGetOppositeMatchedVertexFromEdge.
@Test
public void shouldGetOppositeMatchedVertexFromEdge() {
// Given
final EntityIdExtractor extractor = new EntityIdExtractor(IdentifierType.ADJACENT_MATCHED_VERTEX);
final Edge edge = new Edge.Builder().group(TestGroups.EDGE).source("1").dest("2").directed(false).build();
// When
final EntityId seed = extractor._apply(edge);
// Then
assertEquals("2", seed.getVertex());
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class EntityIdExtractorTest method shouldGetMatchedVertexFromEdge.
@Test
public void shouldGetMatchedVertexFromEdge() {
// Given
final EntityIdExtractor extractor = new EntityIdExtractor(IdentifierType.MATCHED_VERTEX);
final Edge edge = new Edge.Builder().group(TestGroups.EDGE).source("1").dest("2").directed(false).build();
// When
final EntityId seed = extractor._apply(edge);
// Then
assertEquals("1", seed.getVertex());
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class EntityIdExtractorTest method shouldGetDestinationFromEdge.
@Test
public void shouldGetDestinationFromEdge() {
// Given
final EntityIdExtractor extractor = new EntityIdExtractor(IdentifierType.DESTINATION);
final Edge edge = new Edge.Builder().group(TestGroups.EDGE).source("1").dest("2").directed(false).build();
// When
final EntityId seed = extractor._apply(edge);
// Then
assertEquals("2", seed.getVertex());
}
Aggregations