use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class ImportCommandTest method failIfDestinationDatabaseAlreadyExists.
@Test
public void failIfDestinationDatabaseAlreadyExists() throws Exception {
try (NullOutsideWorld outsideWorld = new NullOutsideWorld()) {
Path homeDir = testDir.directory("home").toPath();
ImportCommand importCommand = new ImportCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld);
putStoreInDirectory(homeDir.resolve("data").resolve("databases").resolve("existing.db"));
String[] arguments = { "--mode=csv", "--database=existing.db" };
try {
importCommand.execute(arguments);
fail("Should have thrown an exception.");
} catch (Exception e) {
assertThat(e.getMessage(), containsString("already contains a database"));
}
}
}
use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class ImportCommandTest method requiresDatabaseArgument.
@Test
public void requiresDatabaseArgument() throws Exception {
try (NullOutsideWorld outsideWorld = new NullOutsideWorld()) {
ImportCommand importCommand = new ImportCommand(testDir.directory("home").toPath(), testDir.directory("conf").toPath(), outsideWorld);
String[] arguments = { "--mode=database", "--from=bar" };
try {
importCommand.execute(arguments);
fail("Should have thrown an exception.");
} catch (IncorrectUsage e) {
assertThat(e.getMessage(), containsString("database"));
}
}
}
Aggregations