package me.footlights.boot;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.LinkedHashSet;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import com.google.common.collect.Sets;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


/** Tests {@link FootlightsClassLoader}. */
public class FootlightsClassLoaderTest
{
	@Before public void setUp() throws MalformedURLException
	{
		pluginLoader = Mockito.mock(PluginClassLoader.class);

		LinkedHashSet<URL> classpaths = Sets.newLinkedHashSet();
		for (String path : System.getProperty("java.class.path").split(":"))
		{
			path = path.replace("Client/Bootstrap", "Client/Core");

			if (path.startsWith("/")) path = "file://" + path;
			classpaths.add(new URL(path));
		}

		loader = new FootlightsClassLoader(classpaths);
	}

	/** Make sure we can load classes from {@link me.footlights.core}. */
	@Test public void testLoadingCore() throws ClassNotFoundException
	{
		Class<?> c = loader.loadClass("me.footlights.core.Core");
		assertNotNull(c);
		assertEquals("me.footlights.core.Core", c.getCanonicalName());
	}


	private PluginClassLoader pluginLoader;
	private FootlightsClassLoader loader;

	private static final String PLUGIN =
    	"jar:file://"
    	 + System.getProperty("java.class.path")
    	   .replaceFirst("Client/PluginIntegrationTest/.*", "Client/Plugins/PLUGIN_NAME/target/");
}

@@ -65,65 +65,8 @@
 on;%0A
-import java.net.URI;%0Aimport java.net.URISyntaxException;%0A
 impo
@@ -82,16 +82,16 @@
 et.URL;%0A
+
 import j
@@ -119,33 +119,8 @@
 t;%0A%0A
-import org.junit.Assert;%0A
 impo
@@ -166,36 +166,8 @@
 est;
-%0Aimport org.mockito.Mockito;
 %0A%0Aim
@@ -299,128 +299,8 @@
 ll;%0A
-import static org.junit.Assert.fail;%0A%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A
 %0A%0A/*
@@ -447,65 +447,8 @@
 %0A%09%7B%0A
-%09%09pluginLoader = Mockito.mock(PluginClassLoader.class);%0A%0A
 %09%09Li
@@ -1088,277 +1088,36 @@
 ate 
-PluginClassLoader pluginLoader;%0A%09private FootlightsClassLoader loader;%0A%0A%09private static final String PLUGIN =%0A    %09%22jar:file://%22%0A    %09 + System.getProperty(%22java.class.path%22)%0A    %09   .replaceFirst(%22Client/PluginIntegrationTest/.*%22, %22Client/Plugins/PLUGIN_NAME/target/%22)
+FootlightsClassLoader loader
 ;%0A%7D%0A

Remove unused stuff