Search in sources :

Example 21 with Property

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

the class PatternPropertyTests method patternsWithDifferentVariablesAndTheSameProperties_ShouldNotBeEquivalent.

@Property
public void patternsWithDifferentVariablesAndTheSameProperties_ShouldNotBeEquivalent(Var var1, Var var2, Set<VarProperty> properties) {
    assumeThat(var1, not(is(var2)));
    VarPatternAdmin varPattern1 = Patterns.varPattern(var1, properties);
    VarPatternAdmin varPattern2 = Patterns.varPattern(var2, properties);
    assertNotEquals(varPattern1, varPattern2);
}
Also used : VarPatternAdmin(ai.grakn.graql.admin.VarPatternAdmin) Property(com.pholser.junit.quickcheck.Property) VarProperty(ai.grakn.graql.admin.VarProperty)

Example 22 with Property

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

the class PatternPropertyTests method theConjunctionOfTwoPatterns_ShouldBeContainedInTheResultingPattern.

@Property
public void theConjunctionOfTwoPatterns_ShouldBeContainedInTheResultingPattern(Pattern pattern1, Pattern pattern2) {
    Set<VarPattern> union = Sets.union(pattern1.admin().varPatterns(), pattern2.admin().varPatterns());
    Pattern conjunction = pattern1.and(pattern2);
    assertEquals(union, conjunction.admin().varPatterns());
}
Also used : VarPattern(ai.grakn.graql.VarPattern) Pattern(ai.grakn.graql.Pattern) VarPattern(ai.grakn.graql.VarPattern) Property(com.pholser.junit.quickcheck.Property) VarProperty(ai.grakn.graql.admin.VarProperty)

Example 23 with Property

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

the class GraknTxPropertyTest method whenCallingGetEntityType_TheResultIsTheSameAsGetSchemaConcept.

@Property
public void whenCallingGetEntityType_TheResultIsTheSameAsGetSchemaConcept(@Open GraknTx graph, @FromTx EntityType type) {
    Label label = type.getLabel();
    assertSameResult(() -> graph.getSchemaConcept(label), () -> graph.getEntityType(label.getValue()));
}
Also used : Label(ai.grakn.concept.Label) MetaSchema.isMetaLabel(ai.grakn.util.Schema.MetaSchema.isMetaLabel) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) Property(com.pholser.junit.quickcheck.Property)

Example 24 with Property

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

the class GraknTxPropertyTest method whenCallingGetSchemaConceptWithAnExistingLabel_ItReturnsThatConcept.

@Property
public void whenCallingGetSchemaConceptWithAnExistingLabel_ItReturnsThatConcept(@Open GraknTx graph, @FromTx SchemaConcept concept) {
    Label label = concept.getLabel();
    assertEquals(concept, graph.getSchemaConcept(label));
}
Also used : Label(ai.grakn.concept.Label) MetaSchema.isMetaLabel(ai.grakn.util.Schema.MetaSchema.isMetaLabel) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) Property(com.pholser.junit.quickcheck.Property)

Example 25 with Property

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

the class GraknTxPropertyTest method whenCallingHasWithMetaResourceType_ThrowMetaTypeImmutableException.

@Property
public void whenCallingHasWithMetaResourceType_ThrowMetaTypeImmutableException(@Open GraknTx graph, @FromTx Type type) {
    AttributeType resource = graph.admin().getMetaAttributeType();
    exception.expect(GraknTxOperationException.class);
    if (Schema.MetaSchema.isMetaLabel(type.getLabel())) {
        exception.expectMessage(GraknTxOperationException.metaTypeImmutable(type.getLabel()).getMessage());
    } else {
        exception.expectMessage(GraknTxOperationException.metaTypeImmutable(resource.getLabel()).getMessage());
    }
    type.attribute(resource);
}
Also used : AttributeType(ai.grakn.concept.AttributeType) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) 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