Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Mar 28, 2022
1 parent d847286 commit 5410126
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/resources/helper.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
To gain access to more advanced features of OMERO
from within a macro, put the following line at the
beginning of your macro:
```

run("OMERO Extensions");
```

This will enable the following macro functions:


Expand Down
21 changes: 18 additions & 3 deletions src/test/java/fr/igred/ij/plugin/OMEROExtensionErrorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package fr.igred.ij.plugin;


import ij.IJ;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -27,6 +28,7 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Files;

Expand Down Expand Up @@ -68,10 +70,23 @@ public void tearDown() {


@Test
void testRun() {
void testRun() throws IOException {
ext.run("");
String expected = "Cannot install extensions from outside a macro!";
assertEquals(expected, outContent.toString().trim());
String expected = String.format("The macro extensions are designed to be used within a macro.%n" +
"Instructions on doing so will be printed to the Log window.%n");
try (InputStream is = ext.getClass().getResourceAsStream("/helper.md")) {
if(is != null) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[2 ^ 10];
int length = is.read(buffer);
while (length != -1) {
result.write(buffer, 0, length);
length = is.read(buffer);
}
expected += result.toString("UTF-8");
}
}
assertEquals(expected.trim(), outContent.toString().trim());
}


Expand Down

0 comments on commit 5410126

Please sign in to comment.