Skip to content

Commit 44c044d

Browse files
committed
JavaEngineTest: add annotation test
Test that annotations are preserved
1 parent 06d8ee7 commit 44c044d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,32 @@ public void testEvalReader() throws Exception {
167167
assertTrue(result);
168168
}
169169

170+
@Test
171+
public void testAnnotations() {
172+
boolean result = true;
173+
final String source = "" + //
174+
"import org.scijava.command.Command;\n" + //
175+
"import org.scijava.plugin.Plugin;\n" + //
176+
"@Plugin(type = Command.class)\n" + //
177+
"public class PluginTest implements Command {\n" + //
178+
"\t@Override\n" + //
179+
"\tpublic void run() {\n" + //
180+
"\t\tSystem.out.println(\"I am a plugin!\");\n" + //
181+
"\t}\n" + //
182+
"}";
183+
184+
final ScriptEngine miniMaven = miniMaven();
185+
try {
186+
miniMaven.eval(source);
187+
}
188+
catch (final ScriptException e) {
189+
e.printStackTrace();
190+
result = false;
191+
}
192+
193+
assertTrue(result);
194+
}
195+
170196
// -- helper functions
171197

172198
private File makeMinimalProject() throws IOException {

0 commit comments

Comments
 (0)