imagej / imagej/ImageJ

Failing tests "VirtualStackTest.java"

Open
#257 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
786
Forks
267
PR merge metrics
No merged PRs in 30d

Description

There are two tests failing for the [VirtualStackTest](https://github.com/imagej/ImageJ/blob/master/tests/ij/VirtualStackTest.java) `public void testGetDirectory()` fails because [VirtualStack#getDirectory]() uses, "IJ.addSeparator" which changes the string. The simple fix is to change the test to:

assertEquals(IJ.addSeparator("mySuperDuperPath"),vs.getDirectory());

Maybe the correct way would be to convert the original path and the returned path to a path object and make sure they point at the same place.

The second test `public void testDeleteSlice()` failes because [VirtualStack#deleteSlice](https://github.com/imagej/ImageJ/blob/7746fcb0f5744a7a7758244c5dcd2193459e6e0e/ij/VirtualStack.java#L109) just returns if the stack is empty. The test implies the method should fail. Maybe the test needs to check another way, *eg* If the size doesn't change, then the delete failed?

Alternatively comment the two lines, and now it fails.

/** Deletes the specified slice, where {@literal 1<=n<=nslices}. */
public void deleteSlice(int n) {
#if (nSlices==0)
# return;
if (n<1 || n>nSlices)
throw new IllegalArgumentException("Argument out of range: "+n);
for (int i=n; i

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tests/ij/VirtualStackTest.java and inspect testGetDirectory() and testDeleteSlice(), then read VirtualStack#getDirectory() and deleteSlice(). Run the failing tests to confirm the current behavior. Done means the intended path comparison and empty-stack deletion behavior are decided and both tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.