use of ai.grakn.concept.Role in project grakn by graknlabs.
the class RemoteConceptsTest method whenSettingRelates_ExecuteAConceptMethod.
@Test
public void whenSettingRelates_ExecuteAConceptMethod() {
Role role = RemoteConcepts.createRole(tx, A);
assertEquals(relationshipType, relationshipType.relates(role));
verifyConceptMethodCalled(ConceptMethods.setRelatedRole(role));
}
use of ai.grakn.concept.Role in project grakn by graknlabs.
the class RemoteConceptsTest method whenDeletingPlays_ExecuteAConceptMethod.
@Test
public void whenDeletingPlays_ExecuteAConceptMethod() {
Role role = RemoteConcepts.createRole(tx, A);
assertEquals(type, type.deletePlays(role));
verifyConceptMethodCalled(ConceptMethods.unsetRolePlayedByType(role));
}
use of ai.grakn.concept.Role in project grakn by graknlabs.
the class RemoteConceptsTest method whenCallingAddRolePlayer_ExecuteAConceptMethod.
@Test
public void whenCallingAddRolePlayer_ExecuteAConceptMethod() {
Role role = RemoteConcepts.createRole(tx, A);
Thing thing = RemoteConcepts.createEntity(tx, B);
assertEquals(relationship, relationship.addRolePlayer(role, thing));
verifyConceptMethodCalled(ConceptMethods.setRolePlayer(RolePlayer.create(role, thing)));
}
use of ai.grakn.concept.Role in project grakn by graknlabs.
the class RemoteConceptsTest method whenCallingRolePlayersWithNoArguments_GetTheExpectedResult.
@Test
public void whenCallingRolePlayersWithNoArguments_GetTheExpectedResult() {
Role foo = RemoteConcepts.createRole(tx, ConceptId.of("foo"));
Thing a = RemoteConcepts.createEntity(tx, A);
Thing b = RemoteConcepts.createRelationship(tx, B);
Thing c = RemoteConcepts.createAttribute(tx, C);
Stream<RolePlayer> expected = Stream.of(RolePlayer.create(foo, a), RolePlayer.create(foo, b), RolePlayer.create(foo, c));
mockConceptMethod(ConceptMethods.GET_ROLE_PLAYERS, expected);
assertThat(relationship.rolePlayers().collect(toSet()), containsInAnyOrder(a, b, c));
}
use of ai.grakn.concept.Role in project grakn by graknlabs.
the class RemoteConceptsTest method whenCallingThingPlays_GetTheExpectedResult.
@Test
public void whenCallingThingPlays_GetTheExpectedResult() {
Role a = RemoteConcepts.createRole(tx, A);
Role b = RemoteConcepts.createRole(tx, B);
Role c = RemoteConcepts.createRole(tx, C);
mockConceptMethod(ConceptMethods.GET_ROLES_PLAYED_BY_THING, Stream.of(a, b, c));
assertThat(thing.plays().collect(toSet()), containsInAnyOrder(a, b, c));
}
Aggregations