Skip to content

Commit

Permalink
fix(test): no need to remove() when createTempN5Writer()
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhulbert committed Mar 1, 2024
1 parent 07e5388 commit 003c0ff
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/test/java/org/janelia/saalfeldlab/n5/AbstractN5Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand Down Expand Up @@ -649,8 +648,6 @@ public void testNullAttributes() throws URISyntaxException, IOException {
writer.setAttribute(groupName, "existingValue", null);
assertThrows(N5ClassCastException.class, () -> writer.getAttribute(groupName, "existingValue", Integer.class));
assertEquals(JsonNull.INSTANCE, writer.getAttribute(groupName, "existingValue", JsonElement.class));

writer.remove();
}

/* without serializeNulls*/
Expand Down Expand Up @@ -805,8 +802,6 @@ public void testRemoveAttributes() throws IOException, URISyntaxException {
writer.setAttribute("foo", "a", 100);
writer.removeAttribute("foo", "a");
assertNull(writer.getAttribute("foo", "a", Integer.class));

writer.remove();
}
}

Expand Down Expand Up @@ -863,9 +858,7 @@ public void testList() {
assertArrayEquals(new String[]{"test"}, listN5.list("/"));

// calling list on a non-existant group throws an exception
assertThrows(N5Exception.class, () -> {
listN5.list("this-group-does-not-exist");
});
assertThrows(N5Exception.class, () -> listN5.list("this-group-does-not-exist"));

}
}
Expand Down Expand Up @@ -1071,12 +1064,7 @@ public void testVersion() throws NumberFormatException, IOException, URISyntaxEx
final Version version = writer.getVersion();
assertFalse(N5Reader.VERSION.isCompatible(version));

assertThrows(N5Exception.N5IOException.class, () -> {
final String containerPath = writer.getURI().toString();
final N5Writer newWriter = createTempN5Writer(containerPath);
newWriter.remove();
newWriter.close();
});
assertThrows(N5Exception.N5IOException.class, () -> createTempN5Writer(writer.getURI().toString()));

final Version compatibleVersion = new Version(N5Reader.VERSION.getMajor(), N5Reader.VERSION.getMinor(), N5Reader.VERSION.getPatch());
writer.setAttribute("/", N5Reader.VERSION_KEY, compatibleVersion.toString());
Expand Down Expand Up @@ -1173,7 +1161,7 @@ protected boolean testDeleteIsBlockDeleted(final DataBlock<?> dataBlock) {
return dataBlock == null;
}

public class TestData<T> {
public static class TestData<T> {

public String groupPath;
public String attributePath;
Expand Down

0 comments on commit 003c0ff

Please sign in to comment.