Search in sources :

Example 61 with Property

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

the class EntityTypePropertyTest method whenAddingAnEntity_TheDirectTypeOfTheEntityIsTheTypeItWasCreatedFrom.

@Property
public void whenAddingAnEntity_TheDirectTypeOfTheEntityIsTheTypeItWasCreatedFrom(@NonMeta @NonAbstract EntityType type) {
    Entity entity = type.addEntity();
    assertEquals(type, entity.type());
}
Also used : Entity(ai.grakn.concept.Entity) Property(com.pholser.junit.quickcheck.Property)

Example 62 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 63 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 64 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 65 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)

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