Search in sources :

Example 66 with Property

use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.

the class GraknTxPutPropertyTest method whenCallingPutRole_CreateATypeWithSuperRole.

@Property
public void whenCallingPutRole_CreateATypeWithSuperRole(@Open GraknTx graph, @Unused Label label) {
    Role role = graph.putRole(label);
    assertEquals(graph.admin().getMetaRole(), role.sup());
}
Also used : Role(ai.grakn.concept.Role) Property(com.pholser.junit.quickcheck.Property)

Example 67 with Property

use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.

the class GraknTxPutPropertyTest method whenCallingPutRole_CreateARoleWithDefaultProperties.

@Property
public void whenCallingPutRole_CreateARoleWithDefaultProperties(@Open GraknTx graph, @Unused Label label) {
    Role role = graph.putRole(label);
    assertThat("The role should be played by no types", role.playedByTypes().collect(toSet()), empty());
    assertThat("The role should be owned by no relation types", role.relationshipTypes().collect(toSet()), empty());
}
Also used : Role(ai.grakn.concept.Role) Property(com.pholser.junit.quickcheck.Property)

Example 68 with Property

use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.

the class GraknTxPutPropertyTest method whenCallingPutRelationTypeWithAnExistingRelationTypeLabel_ItReturnsThatType.

@Property
public void whenCallingPutRelationTypeWithAnExistingRelationTypeLabel_ItReturnsThatType(@Open GraknTx graph, @FromTx RelationshipType relationshipType) {
    RelationshipType newType = graph.putRelationshipType(relationshipType.getLabel());
    assertEquals(relationshipType, newType);
}
Also used : RelationshipType(ai.grakn.concept.RelationshipType) Property(com.pholser.junit.quickcheck.Property)

Example 69 with Property

use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.

the class GraknTxPutPropertyTest method whenCallingPutRule_CreateATypeWithSuperTypeRule.

@Property
public void whenCallingPutRule_CreateATypeWithSuperTypeRule(@Open GraknTx tx, @Unused Label label) {
    Rule rule = tx.putRule(label, tx.graql().parser().parsePattern("$x"), tx.graql().parser().parsePattern("$x"));
    assertEquals(tx.admin().getMetaRule(), rule.sup());
}
Also used : Rule(ai.grakn.concept.Rule) Property(com.pholser.junit.quickcheck.Property)

Example 70 with Property

use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.

the class SchemaConceptPropertyTest method whenASchemaElementHasADirectSuper_ItIsADirectSubOfThatSuper.

@Property
public void whenASchemaElementHasADirectSuper_ItIsADirectSubOfThatSuper(SchemaConcept schemaConcept) {
    SchemaConcept superConcept = schemaConcept.sup();
    assumeTrue(superConcept != null);
    assertThat(PropertyUtil.directSubs(superConcept), hasItem(schemaConcept));
}
Also used : SchemaConcept(ai.grakn.concept.SchemaConcept) 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