use of com.enonic.xp.core.impl.export.writer.ExportWriter in project xp by enonic.
the class NodeExportIntegrationTest method one_node_error.
@Test
public void one_node_error() throws Exception {
createNode("mynode", NodePath.ROOT);
final ExportWriter exportWriter = Mockito.mock(ExportWriter.class);
Mockito.doThrow(new RuntimeException("exception message")).when(exportWriter).writeElement(Mockito.isA(Path.class), Mockito.anyString());
final NodeExportResult result = NodeExporter.create().nodeService(this.nodeService).nodeExportWriter(exportWriter).sourceNodePath(NodePath.ROOT).targetDirectory(this.temporaryFolder.resolve("myExport")).build().execute();
assertEquals(1, result.getExportErrors().size());
assertEquals("java.lang.RuntimeException: exception message", result.getExportErrors().get(0).toString());
}
Aggregations