@Test public void testFileWritingExceptionsShowErrorDialog() throws Exception { final File exceptionsThrowingFile = mock(File.class); when(exceptionsThrowingFile.getAbsolutePath()).thenReturn("/.stl/"); final DefaultLinearAxis xAxis = new DefaultLinearAxis(Axes.X, "mm"); final DefaultLinearAxis yAxis = new DefaultLinearAxis(Axes.Y, "mm"); final DefaultLinearAxis zAxis = new DefaultLinearAxis(Axes.Z, "mm"); final Img<BitType> img = ArrayImgs.bits(1, 1, 1); final ImgPlus<BitType> imgPlus = new ImgPlus<>(img, "Test image", xAxis, yAxis, zAxis); final SwingDialogPrompt mockPrompt = mock(SwingDialogPrompt.class); when(MOCK_UI.chooseFile(any(File.class), anyString())).thenReturn( exceptionsThrowingFile); when(MOCK_UI.dialogPrompt(startsWith(STL_WRITE_ERROR), anyString(), eq( ERROR_MESSAGE), any())).thenReturn(mockPrompt); command().run(SurfaceAreaWrapper.class, true, "inputImage", imgPlus, "exportSTL", true).get(); verify(MOCK_UI, timeout(1000).times(1)).dialogPrompt(startsWith( STL_WRITE_ERROR), anyString(), eq(ERROR_MESSAGE), any()); }
@Override public void run() { statusService.showStatus("Surface area: initialising"); subspaces = find3DSubspaces(inputImage); matchOps(subspaces.get(0).interval); prepareResults(); final Map<String, Mesh> meshes = createMeshes(subspaces); if (exportSTL) { if (!getFileName()) { return; } saveMeshes(meshes); } calculateAreas(meshes); resultsTable = SharedTable.getTable(); reportUsage(); }
SurfaceAreaWrapper extends BoneJCommand { @Override public void run() { statusService.showStatus("Surface area: initialising"); subspaces = find3DSubspaces(inputImage); matchOps(subspaces.get(0).interval); prepareResults(); final Map<String, Mesh> meshes = createMeshes(subspaces); if (exportSTL) { if (!getFileName()) { return; } saveMeshes(meshes); } calculateAreas(meshes); resultsTable = SharedTable.getTable(); reportUsage(); } }
SurfaceAreaWrapper extends BoneJCommand { @Override public void run() { statusService.showStatus("Surface area: initialising"); subspaces = find3DSubspaces(inputImage); matchOps(subspaces.get(0).interval); prepareResults(); final Map<String, Mesh> meshes = createMeshes(subspaces); if (exportSTL) { if (!getFileName()) { return; } saveMeshes(meshes); } calculateAreas(meshes); resultsTable = SharedTable.getTable(); reportUsage(); }  }
SurfaceAreaWrapper extends BoneJCommand { @Override public void run() { statusService.showStatus("Surface area: initialising"); subspaces = find3DSubspaces(inputImage); matchOps(subspaces.get(0).interval); prepareResults(); final Map<String, Mesh> meshes = createMeshes(subspaces); if (exportSTL) { if (!getFileName()) { return; } saveMeshes(meshes); } calculateAreas(meshes); resultsTable = SharedTable.getTable(); reportUsage(); }  @Override void run(); }
SurfaceAreaWrapper extends BoneJCommand { @Override public void run() { statusService.showStatus("Surface area: initialising"); subspaces = find3DSubspaces(inputImage); matchOps(subspaces.get(0).interval); prepareResults(); final Map<String, Mesh> meshes = createMeshes(subspaces); if (exportSTL) { if (!getFileName()) { return; } saveMeshes(meshes); } calculateAreas(meshes); resultsTable = SharedTable.getTable(); reportUsage(); }  @Override void run();  }