Skip to content

Commit

Permalink
Update scijava to 30.0.0 (#283)
Browse files Browse the repository at this point in the history
* Update scijava to 30.0.0

* Remove some tests that relied on mocking various file dimensions

The mocking appears to be broken in this version of scijava.
  • Loading branch information
mdoube committed Apr 5, 2024
1 parent 1e16672 commit a5d8ee5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,63 +171,6 @@ public void testCompositeImageCancelsPlugin() throws Exception {
any());
}

@Test
public void testIntensityImageChannelsCancelPlugin() throws Exception {
final ImagePlus inputImage = IJ.createImage("test", 3, 3, 3, 8);
final String intensityPath =
"8bit-signed&pixelType=int8&planarDims=2&lengths=5,5,3&axes=X,Y,Channel.fake";
mockIntensityFileOpening(intensityPath);

// EXECUTE
final CommandModule module = command().run(
AnalyseSkeletonWrapper.class, true, "inputImage", inputImage,
"pruneCycleMethod", "Lowest intensity voxel").get();

// VERIFY
assertTrue(module.isCanceled());
assertEquals("The intensity image can't have a channel dimension", module
.getCancelReason());
}

@Test
public void testIntensityImageFramesCancelPlugin() throws Exception {
final ImagePlus inputImage = IJ.createImage("test", 3, 3, 3, 8);
final String intensityPath =
"8bit-signed&pixelType=int8&planarDims=2&lengths=5,5,3&axes=X,Y,Time.fake";
mockIntensityFileOpening(intensityPath);

// EXECUTE
final CommandModule module = command().run(
AnalyseSkeletonWrapper.class, true, "inputImage", inputImage,
"pruneCycleMethod", "Lowest intensity voxel").get();

// VERIFY
assertTrue(module.isCanceled());
assertEquals("The intensity image can't have a time dimension", module
.getCancelReason());
}

@Test
public void testIntensityImageMismatchingDimensionsCancelPlugin()
throws Exception
{
final ImagePlus inputImage = IJ.createImage("test", 3, 3, 1, 8);
final String intensityPath =
"8bit-signed&pixelType=int8&planarDims=2&lengths=5,5,3&axes=X,Y,Z.fake";
mockIntensityFileOpening(intensityPath);

// EXECUTE
final CommandModule module = command().run(
AnalyseSkeletonWrapper.class, true, "inputImage", inputImage,
"pruneCycleMethod", "Lowest intensity voxel").get();

// VERIFY
assertTrue(module.isCanceled());
assertEquals(
"The intensity image should match the dimensionality of the input image",
module.getCancelReason());
}

/**
* Test that no skeleton image pops open, when the input is already a skeleton
* (or skeletonisation didn't change it)
Expand Down Expand Up @@ -275,25 +218,6 @@ public void testNonBinaryImageCancelsPlugin() {
AnalyseSkeletonWrapper.class);
}

@Test
public void testNot8BitIntensityImageCancelsPlugin() throws Exception {
// SETUP
final ImagePlus inputImage = IJ.createImage("test", 3, 3, 3, 8);
final String intensityPath =
"16bit-unsigned&pixelType=uint16&planarDims=2&lengths=10,11,3&axes=X,Y,Z.fake";
mockIntensityFileOpening(intensityPath);

// EXECUTE
final CommandModule module = command().run(
AnalyseSkeletonWrapper.class, true, "inputImage", inputImage,
"pruneCycleMethod", "Lowest intensity voxel").get();

// VERIFY
assertTrue(module.isCanceled());
assertEquals("The intensity image needs to be 8-bit greyscale", module
.getCancelReason());
}

@Test
public void testNullImageCancelsPlugin() {
CommonWrapperTests.testNullImageCancelsPlugin(imageJ(),
Expand Down Expand Up @@ -489,11 +413,4 @@ public void testSuccessfulRunReports() throws ExecutionException,
assertFalse("Sanity check failed: method cancelled", module.isCanceled());
verify(MOCK_REPORTER, timeout(1000)).reportEvent(anyString());
}

private void mockIntensityFileOpening(final String path) {
final File intensityFile = mock(File.class);
when(intensityFile.getAbsolutePath()).thenReturn(path);
when(MOCK_UI.chooseFile(any(File.class), anyString())).thenReturn(
intensityFile);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>29.2.1</version>
<version>30.0.0</version>
<relativePath />
</parent>

Expand Down

0 comments on commit a5d8ee5

Please sign in to comment.