use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingPutEntityTypeWithAnExistingEntityTypeLabel_ItReturnsThatType.
@Property
public void whenCallingPutEntityTypeWithAnExistingEntityTypeLabel_ItReturnsThatType(@Open GraknTx graph, @FromTx EntityType entityType) {
EntityType newType = graph.putEntityType(entityType.getLabel());
assertEquals(entityType, newType);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingPutResourceTypeWithAnExistingNonUniqueResourceTypeLabelButADifferentDataType_Throw.
@Property
public void whenCallingPutResourceTypeWithAnExistingNonUniqueResourceTypeLabelButADifferentDataType_Throw(@Open GraknTx graph, @FromTx AttributeType<?> attributeType, AttributeType.DataType<?> dataType) {
assumeThat(dataType, not(is(attributeType.getDataType())));
Label label = attributeType.getLabel();
exception.expect(GraknTxOperationException.class);
if (isMetaLabel(label)) {
exception.expectMessage(GraknTxOperationException.metaTypeImmutable(label).getMessage());
} else {
exception.expectMessage(GraknTxOperationException.immutableProperty(attributeType.getDataType(), dataType, Schema.VertexProperty.DATA_TYPE).getMessage());
}
graph.putAttributeType(label, dataType);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingPutRuleWithAnExistingRuleTypeLabel_ItReturnsThatType.
@Property
public void whenCallingPutRuleWithAnExistingRuleTypeLabel_ItReturnsThatType(@Open GraknTx tx, @FromTx Rule rule) {
Rule newType = tx.putRule(rule.getLabel(), tx.graql().parser().parsePattern("$x"), tx.graql().parser().parsePattern("$x"));
assertEquals(rule, newType);
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class GraknTxPutPropertyTest method whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithTheGivenLabel.
@Property
public void whenCallingAnyPutSchemaConceptMethod_CreateAnOntologyConceptWithTheGivenLabel(@Open GraknTx graph, @Unused Label label, @From(PutSchemaConceptFunctions.class) BiFunction<GraknTx, Label, SchemaConcept> putSchemaConcept) {
SchemaConcept type = putSchemaConcept.apply(graph, label);
assertEquals(label, type.getLabel());
}
use of com.pholser.junit.quickcheck.Property in project grakn by graknlabs.
the class SchemaConceptPropertyTest method whenDeletingASchemaConceptWithDirectSubs_Throw.
@Property
public void whenDeletingASchemaConceptWithDirectSubs_Throw(@NonMeta SchemaConcept schemaConcept) {
SchemaConcept superConcept = schemaConcept.sup();
assumeFalse(isMetaLabel(superConcept.getLabel()));
exception.expect(GraknTxOperationException.class);
exception.expectMessage(GraknTxOperationException.cannotBeDeleted(superConcept).getMessage());
superConcept.delete();
}
Aggregations