package org.aksw.limes.core.ml;

import org.aksw.limes.core.exceptions.UnsupportedMLImplementationException;
import org.aksw.limes.core.ml.algorithm.ACIDS;
import org.aksw.limes.core.ml.algorithm.ActiveMLAlgorithm;
import org.aksw.limes.core.ml.algorithm.EAGLE;
import org.aksw.limes.core.ml.algorithm.MLAlgorithmFactory;
import org.aksw.limes.core.ml.algorithm.MLImplementationType;
import org.aksw.limes.core.ml.algorithm.SupervisedMLAlgorithm;
import org.aksw.limes.core.ml.algorithm.UnsupervisedMLAlgorithm;
import org.junit.Test;

import static org.junit.Assert.*;

public class UsageTest {

	@Test
	public void testSupervisedBatch() {

		SupervisedMLAlgorithm eagle = null;
		try {
			eagle = MLAlgorithmFactory.createMLAlgorithm(EAGLE.class, 
					MLImplementationType.SUPERVISED_BATCH).asSupervised();
		} catch (UnsupportedMLImplementationException e) {
			e.printStackTrace();
			fail();
		}
		assert (eagle.getClass().equals(SupervisedMLAlgorithm.class));
		
	}

	@Test
	public void testUnsupervised() {

		UnsupervisedMLAlgorithm eagleU = null;
		try {
			eagleU = MLAlgorithmFactory.createMLAlgorithm(EAGLE.class,
					MLImplementationType.UNSUPERVISED).asUnsupervised();
		} catch (UnsupportedMLImplementationException e) {
			e.printStackTrace();
			fail();
		}
		assert (eagleU.getClass().equals(UnsupervisedMLAlgorithm.class));

	}

	@Test
	public void testActive() {

		ActiveMLAlgorithm acids = null;
		try {
			acids = MLAlgorithmFactory.createMLAlgorithm(ACIDS.class,
					MLImplementationType.SUPERVISED_ACTIVE).asActive();
		} catch (UnsupportedMLImplementationException e) {
			e.printStackTrace();
			fail();
		}
		assert (acids.getClass().equals(ActiveMLAlgorithm.class));

	}

	@Test
	public void testFailure() {

		boolean itFails = false;
		try {
			MLAlgorithmFactory.createMLAlgorithm(EAGLE.class,
					MLImplementationType.SUPERVISED_ACTIVE);
		} catch (UnsupportedMLImplementationException e) {
			itFails = true;
		}
		assert (itFails);

	}

}

@@ -249,20 +249,20 @@
 orithm.E
-AGLE
+agle
 ;%0Aimport
@@ -726,28 +726,28 @@
 LAlgorithm(E
-AGLE
+agle
 .class, %0A%09%09%09
@@ -1100,36 +1100,36 @@
 ateMLAlgorithm(E
-AGLE
+agle
 .class,%0A%09%09%09%09%09MLI
@@ -1814,12 +1814,12 @@
 hm(E
-AGLE
+agle
 .cla

rename EAGLE to Eagle