use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class RelationshipTypePropertyTest method whenDeletingARelatedRole_TheDirectSubTypeRelatedRolesAreUnchanged.
@Property
public void whenDeletingARelatedRole_TheDirectSubTypeRelatedRolesAreUnchanged(@NonMeta RelationshipType subType, @FromTx Role role) {
RelationshipType superType = subType.sup();
assumeFalse(isMetaLabel(superType.getLabel()));
Set<Role> previousHasRoles = subType.relates().collect(toSet());
superType.deleteRelates(role);
Set<Role> newHasRoles = subType.relates().collect(toSet());
assertEquals(previousHasRoles, newHasRoles);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class RelationshipTypePropertyTest method whenAddingARelation_TheRelationHasNoResources.
@Property
public void whenAddingARelation_TheRelationHasNoResources(@NonMeta @NonAbstract RelationshipType type) {
Relationship relationship = type.addRelationship();
assertThat(relationship.attributes().collect(toSet()), empty());
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class RelationshipTypePropertyTest method whenRelatingARole_TheDirectSuperTypeRelatedRolesAreUnchanged.
@Property
public void whenRelatingARole_TheDirectSuperTypeRelatedRolesAreUnchanged(@NonMeta RelationshipType subType, @FromTx Role role) {
RelationshipType superType = subType.sup();
Set<Role> previousHasRoles = superType.relates().collect(toSet());
subType.relates(role);
Set<Role> newHasRoles = superType.relates().collect(toSet());
assertEquals(previousHasRoles, newHasRoles);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class RelationshipTypePropertyTest method whenAddingARelation_TheRelationHasNoRolePlayers.
@Property
public void whenAddingARelation_TheRelationHasNoRolePlayers(@NonMeta @NonAbstract RelationshipType type) {
Relationship relationship = type.addRelationship();
assertThat(relationship.rolePlayers().collect(toSet()), empty());
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class ThingPropertyTest method whenGettingTheDirectTypeOfAThing_TheThingIsADirectInstanceOfThatType.
@Property
public void whenGettingTheDirectTypeOfAThing_TheThingIsADirectInstanceOfThatType(Thing thing) {
Type type = thing.type();
assertThat(PropertyUtil.directInstances(type), hasItem(thing));
}
Aggregations