Search in sources :

Example 51 with Property

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

the class GraknTxPutPropertyTest method whenCallingPutRelationType_CreateATypeThatOwnsNoRoles.

@Property
public void whenCallingPutRelationType_CreateATypeThatOwnsNoRoles(@Open GraknTx graph, @Unused Label label) {
    RelationshipType relationshipType = graph.putRelationshipType(label);
    assertThat(relationshipType.relates().collect(toSet()), empty());
}
Also used : RelationshipType(ai.grakn.concept.RelationshipType) Property(com.pholser.junit.quickcheck.Property)

Example 52 with Property

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

the class GraknTxPutPropertyTest method whenCallingPutResourceTypeWithThePropertiesOfAnExistingResourceType_ItReturnsThatType.

@Property
public void whenCallingPutResourceTypeWithThePropertiesOfAnExistingResourceType_ItReturnsThatType(@Open GraknTx graph, @FromTx AttributeType<?> attributeType) {
    assumeFalse(attributeType.equals(graph.admin().getMetaAttributeType()));
    Label label = attributeType.getLabel();
    AttributeType.DataType<?> dataType = attributeType.getDataType();
    AttributeType<?> newType = graph.putAttributeType(label, dataType);
    assertEquals(attributeType, newType);
}
Also used : AttributeType(ai.grakn.concept.AttributeType) MetaSchema.isMetaLabel(ai.grakn.util.Schema.MetaSchema.isMetaLabel) Label(ai.grakn.concept.Label) Property(com.pholser.junit.quickcheck.Property)

Example 53 with Property

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

the class GraknTxPutPropertyTest method whenCallingPutRelationType_CreateATypeWithSuperTypeRelation.

@Property
public void whenCallingPutRelationType_CreateATypeWithSuperTypeRelation(@Open GraknTx tx, @Unused Label label) {
    RelationshipType relationshipType = tx.putRelationshipType(label);
    assertEquals(tx.admin().getMetaRelationType(), relationshipType.sup());
}
Also used : RelationshipType(ai.grakn.concept.RelationshipType) Property(com.pholser.junit.quickcheck.Property)

Example 54 with Property

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

the class GraknTxPutPropertyTest method whenCallingPutRoleWithAnExistingRoleLabel_ItReturnsThatRole.

@Property
public void whenCallingPutRoleWithAnExistingRoleLabel_ItReturnsThatRole(@Open GraknTx graph, @FromTx Role role) {
    Role newType = graph.putRole(role.getLabel());
    assertEquals(role, newType);
}
Also used : Role(ai.grakn.concept.Role) Property(com.pholser.junit.quickcheck.Property)

Example 55 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)

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