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);
}
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());
}
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()));
}
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));
}
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);
}
Aggregations