Search in sources :

Example 56 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 57 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 58 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 59 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)59 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)15 Role (ai.grakn.concept.Role)11 Label (ai.grakn.concept.Label)10 MetaSchema.isMetaLabel (ai.grakn.util.Schema.MetaSchema.isMetaLabel)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 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 Rule (ai.grakn.concept.Rule)2 Pattern (ai.grakn.graql.Pattern)2 VarPattern (ai.grakn.graql.VarPattern)2 Attribute (ai.grakn.concept.Attribute)1