
package org.bonej.wrapperPlugins;

import static org.junit.Assert.assertTrue;

import java.util.stream.Stream;

import net.imagej.ImageJ;

import org.junit.AfterClass;
import org.junit.Test;
import org.scijava.command.CommandInfo;

/**
 * There is a number of tools which we want to offer BoneJ users, but on which
 * BoneJ2 plugins do not depend in compilation or testing This test checks that
 * those tools are present in vanilla ImageJ2.
 *
 * @author Richard Domander
 */
public class BundleTest {

	private static final ImageJ IMAGE_J = new ImageJ();

	@AfterClass
	public static void oneTimeTearDown() {
		IMAGE_J.context().dispose();
	}

	@Test
	public void checkErode() {
		final Stream<CommandInfo> commands = IMAGE_J.command().getCommands()
			.stream();

		assertTrue(commands.anyMatch(i -> i.getClassName().equals(
			"net.imagej.plugins.commands.binary.ErodeBinaryImage")));
	}

	@Test
	public void checkDilate() {
		final Stream<CommandInfo> commands = IMAGE_J.command().getCommands()
			.stream();

		assertTrue(commands.anyMatch(i -> i.getClassName().equals(
			"net.imagej.plugins.commands.binary.DilateBinaryImage")));
	}
}

@@ -224,16 +224,54 @@
 andInfo;
+%0Aimport org.scijava.plugin.PluginInfo;
 %0A%0A/**%0A *
@@ -379,16 +379,19 @@
  depend 
+on 
 in compi
@@ -464,23 +464,29 @@
  in 
-vanilla ImageJ2
+the build environment
 .%0A *
@@ -1179,13 +1179,559 @@
 ge%22)));%0A
-
 %09%7D
+%0A%0A%09@Test%0A    public void checkScancoISQFormat() %7B%0A        final Stream%3CPluginInfo%3C?%3E%3E infoStream = IMAGE_J.plugin().getPlugins().stream();%0A%0A        assertTrue(infoStream.anyMatch(i -%3E i.getClassName().equals(%22io.scif.formats.ScancoISQFormat%22)));%0A    %7D%0A%0A    @Test%0A    public void checkKontronFormat() %7B%0A        final Stream%3CPluginInfo%3C?%3E%3E infoStream = IMAGE_J.plugin().getPlugins().stream();%0A%0A        assertTrue(infoStream.anyMatch(i -%3E i.getClassName().equals(%22io.scif.formats.KontronFormat%22)));%0A    %7D%0A%0A    // TODO add test for StratecPQCT format
 %0A%7D%0A

Update bundle tests