Search in sources :

Example 31 with Property

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);
}
Also used : Role(ai.grakn.concept.Role) RelationshipType(ai.grakn.concept.RelationshipType) Property(com.pholser.junit.quickcheck.Property)

Example 32 with Property

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());
}
Also used : Relationship(ai.grakn.concept.Relationship) Property(com.pholser.junit.quickcheck.Property)

Example 33 with Property

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);
}
Also used : Role(ai.grakn.concept.Role) RelationshipType(ai.grakn.concept.RelationshipType) Property(com.pholser.junit.quickcheck.Property)

Example 34 with Property

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());
}
Also used : Relationship(ai.grakn.concept.Relationship) Property(com.pholser.junit.quickcheck.Property)

Example 35 with Property

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));
}
Also used : Type(ai.grakn.concept.Type) Property(com.pholser.junit.quickcheck.Property)

Aggregations

Property (com.pholser.junit.quickcheck.Property)82 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)15 Program (com.rox.emu.processor.mos6502.util.Program)12 Role (ai.grakn.concept.Role)11 Label (ai.grakn.concept.Label)10 MetaSchema.isMetaLabel (ai.grakn.util.Schema.MetaSchema.isMetaLabel)10 Mos6502Compiler (com.rox.emu.processor.mos6502.util.Mos6502Compiler)10 SchemaConcept (ai.grakn.concept.SchemaConcept)9 RelationshipType (ai.grakn.concept.RelationshipType)8 AttributeType (ai.grakn.concept.AttributeType)7 VarProperty (ai.grakn.graql.admin.VarProperty)5 Ignore (org.junit.Ignore)5 Relationship (ai.grakn.concept.Relationship)4 Calendar (java.util.Calendar)4 Schema (org.apache.beam.sdk.schemas.Schema)4 ConceptId (ai.grakn.concept.ConceptId)3 Entity (ai.grakn.concept.Entity)3 EntityType (ai.grakn.concept.EntityType)3 Type (ai.grakn.concept.Type)3 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)3