use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPropertyTest method whenCallingSuperTypeOnMetaResourceType_Throw.
// TODO: Fix this
@Ignore
@Property
public void whenCallingSuperTypeOnMetaResourceType_Throw(@Open GraknTx graph) {
AttributeType resource = graph.admin().getMetaAttributeType();
// TODO: Test for a better error message
exception.expect(GraknTxOperationException.class);
// noinspection ResultOfMethodCallIgnored
resource.sup();
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPropertyTest method whenCallingGetRelationType_TheResultIsTheSameAsGetSchemaConcept.
@Property
public void whenCallingGetRelationType_TheResultIsTheSameAsGetSchemaConcept(@Open GraknTx graph, @FromTx RelationshipType type) {
Label label = type.getLabel();
assertSameResult(() -> graph.getSchemaConcept(label), () -> graph.getRelationshipType(label.getValue()));
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class SchemaConceptPropertyTest method whenAddingADirectSubWhichIsAnIndirectSuper_Throw.
// TODO
@Ignore("Test fails due to incorrect error message")
@Property
public void whenAddingADirectSubWhichIsAnIndirectSuper_Throw(@NonMeta SchemaConcept newSubConcept, long seed) {
SchemaConcept concept = PropertyUtil.choose(newSubConcept.subs(), seed);
// Check if the mutation can be performed in a valid manner
if (concept.isType())
assumeThat(concept.asType().plays().collect(Collectors.toSet()), is(empty()));
exception.expect(GraknTxOperationException.class);
exception.expectMessage(GraknTxOperationException.loopCreated(newSubConcept, concept).getMessage());
addDirectSub(concept, newSubConcept);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class TypePropertyTest method whenAddingAPlaysToATypesIndirectSuperType_TheTypePlaysThatRole.
@Property
public void whenAddingAPlaysToATypesIndirectSuperType_TheTypePlaysThatRole(@Open GraknTx tx, @FromTx Type type, @FromTx Role role, long seed) {
SchemaConcept superConcept = PropertyUtil.choose(tx.admin().sups(type), seed);
assumeTrue(superConcept.isType());
assumeFalse(isMetaLabel(superConcept.getLabel()));
Type superType = superConcept.asType();
Set<Role> previousPlays = type.plays().collect(toSet());
superType.plays(role);
Set<Role> newPlays = type.plays().collect(toSet());
assertEquals(newPlays, Sets.union(previousPlays, ImmutableSet.of(role)));
}
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());
}
Aggregations