Search in sources :

Example 6 with Property

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

the class EntityTypePropertyTest method whenAddingAnEntity_TheEntityHasNoResources.

@Property
public void whenAddingAnEntity_TheEntityHasNoResources(@NonMeta @NonAbstract EntityType type) {
    Entity entity = type.addEntity();
    assertThat(entity.attributes().collect(toSet()), empty());
}
Also used : Entity(ai.grakn.concept.Entity) Property(com.pholser.junit.quickcheck.Property)

Example 7 with Property

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

the class EntityTypePropertyTest method whenAddingAnEntity_TheEntityIsInNoRelations.

@Property
public void whenAddingAnEntity_TheEntityIsInNoRelations(@NonMeta @NonAbstract EntityType type) {
    Entity entity = type.addEntity();
    assertThat(entity.relationships().collect(toSet()), empty());
}
Also used : Entity(ai.grakn.concept.Entity) Property(com.pholser.junit.quickcheck.Property)

Example 8 with Property

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

the class GraknTxPutPropertyTest method whenCallingPutEntityType_CreateATypeWithSuperTypeEntity.

@Property
public void whenCallingPutEntityType_CreateATypeWithSuperTypeEntity(@Open GraknTx graph, @Unused Label label) {
    EntityType entityType = graph.putEntityType(label);
    assertEquals(graph.admin().getMetaEntityType(), entityType.sup());
}
Also used : EntityType(ai.grakn.concept.EntityType) Property(com.pholser.junit.quickcheck.Property)

Example 9 with Property

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

the class GraknTxPutPropertyTest method whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithDefaultProperties.

@Property
public void whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithDefaultProperties(@Open GraknTx graph, @Unused Label label, @From(PutSchemaConceptFunctions.class) BiFunction<GraknTx, Label, SchemaConcept> putSchemaConcept) {
    SchemaConcept concept = putSchemaConcept.apply(graph, label);
    assertThat("Concept should only have one sub-type: itself", concept.subs().collect(toSet()), contains(concept));
    assertFalse("Concept should not be implicit", concept.isImplicit());
    assertThat("Rules of hypotheses should be empty", concept.getRulesOfHypothesis().collect(toSet()), empty());
    assertThat("Rules of conclusion should be empty", concept.getRulesOfConclusion().collect(toSet()), empty());
}
Also used : SchemaConcept(ai.grakn.concept.SchemaConcept) Property(com.pholser.junit.quickcheck.Property)

Example 10 with Property

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

the class GraknTxPutPropertyTest method whenCallingAnyPutTypeMethod_CreateATypeWithDefaultProperties.

@Property
public void whenCallingAnyPutTypeMethod_CreateATypeWithDefaultProperties(@Open GraknTx graph, @Unused Label label, @From(PutTypeFunctions.class) BiFunction<GraknTx, Label, Type> putType) {
    Type type = putType.apply(graph, label);
    assertThat("Type should not play any roles", type.plays().collect(toSet()), empty());
    assertFalse("Type should not be abstract", type.isAbstract());
}
Also used : Type(ai.grakn.concept.Type) EntityType(ai.grakn.concept.EntityType) RelationshipType(ai.grakn.concept.RelationshipType) AttributeType(ai.grakn.concept.AttributeType) 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