package BlueTurtle.finders;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import java.io.File;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Set;

import org.junit.Before;
import org.junit.Test;

/**
 * Test for the ProjectInforFinder class.
 * 
 * @author BlueTurtle.
 *
 */
public class ProjectInfoFinderTest {

	private ProjectInfoFinder pif;
	private String exampleFilePath;

	/**
	 * Initialize the objects that are needed.
	 * 
	 * @throws Exception
	 *             throws an exception if problem is encountered while
	 *             instantiating the objects.
	 */
	@Before
	public void setUp() throws Exception {
		pif = new ProjectInfoFinder();
		exampleFilePath = Paths.get("src", "test", "resources", "TestCodeFolder", "AllClosestPoints.java").toAbsolutePath().toString();
		pif.findFiles(new File(Paths.get("src", "test", "resources").toAbsolutePath().toString()));
	}

	/**
	 * Test finding files does not give an empty list of paths.
	 * 
	 */
	@Test
	public void testFindFilesNonEmptyListOfPaths() {
		assertFalse(ProjectInfoFinder.getClassPaths().isEmpty());
	}

	/**
	 * Test that the right package name is returned given a path to a file.
	 * 
	 */
	@Test
	public void testRightPackageNameForPathIsReturned() {
		String packageName = ProjectInfoFinder.getClassPackage().get(exampleFilePath);
		assertEquals("default", packageName);
	}

	/**
	 * Test that the right loc is returned given path.
	 * 
	 */
	@Test
	public void testRightLOCForPathIsReturned() {
		int actual = ProjectInfoFinder.getClassLocs().get(exampleFilePath);
		assertEquals(272, actual);
	}

	/**
	 * Test that the right set of packages names is returned given path.
	 * 
	 */
	@Test
	public void testRightSetOfPackagesIsReturned() {
		Set<String> actual = ProjectInfoFinder.getPackages();
		Set<String> expected = new HashSet<String>();
		expected.add("default");
		assertEquals(expected, actual);
	}

}

@@ -178,22 +178,73 @@
 va.util.
-HashSe
+ArrayList;%0Aimport java.util.HashSet;%0Aimport java.util.Lis
 t;%0Aimpor
@@ -493,16 +493,90 @@
 lePath;%0A
+%09private static String srcDir = System.getProperty(%22user.dir%22) + %22/src%22;%0A%0A
 %0A%09/**%0A%09 
@@ -1062,24 +1062,59 @@
 String()));%0A
+%09%09pif.findFiles(new File(srcDir));%0A
 %09%7D%0A%0A%09/**%0A%09 *
@@ -2043,24 +2043,24 @@
 %3CString%3E();%0A
-
 %09%09expected.a
@@ -2074,16 +2074,358 @@
 ault%22);%0A
+%09%09expected.add(%22BlueTurtle.warnings%22);%0A%09%09expected.add(%22BlueTurtle.groupers%22);%0A%09%09expected.add(%22BlueTurtle.computers%22);%0A%09%09expected.add(%22BlueTurtle.TSE%22);%0A%09%09expected.add(%22BlueTurtle.finders%22);%0A%09%09expected.add(%22BlueTurtle.gui%22);%0A%09%09expected.add(%22BlueTurtle.writers%22);%0A%09%09expected.add(%22BlueTurtle.summarizers%22);%0A%09%09expected.add(%22BlueTurtle.parsers%22);%0A
 %09%09assert

fix the test