use of org.neo4j.unsafe.impl.batchimport.input.DataException in project neo4j by neo4j.
the class CsvInputTest method shouldFailOnMissingRelationshipType.
@Test
public void shouldFailOnMissingRelationshipType() throws Exception {
// GIVEN
String type = "CUSTOM";
DataFactory<InputRelationship> data = data(":START_ID,:END_ID,:TYPE\n" + "0,1," + type + "\n" + "1,2,");
Iterable<DataFactory<InputRelationship>> dataIterable = dataIterable(data);
Input input = new CsvInput(null, null, dataIterable, defaultFormatRelationshipFileHeader(), IdType.ACTUAL, config(COMMAS), silentBadCollector(0), getRuntime().availableProcessors());
// WHEN/THEN
try (ResourceIterator<InputRelationship> relationships = input.relationships().iterator()) {
try {
assertRelationship(relationships.next(), 0L, 1L, type, NO_PROPERTIES);
relationships.next();
fail("Should have failed");
} catch (DataException e) {
assertTrue(e.getMessage().contains(Type.TYPE.name()));
}
}
}
Aggregations