package BlueTurtle.parsers;

import java.util.HashMap;

import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * Test class for GDCParser.
 * 
 * @author BlueTurtle.
 *
 */
public class GDCParserTest {

	private static String testSet = "./resources/htmlExample.html";
	private static String testSet2 = "./resources/asat-gdc-mapping.html";


	/**
	 * Test that the parser can parse a valid GDC html file.
	 */
	@Test
	public void testParseCorrectBehaviour() {
		GDCParser parser = new GDCParser();

		HashMap<String, String> categoryInfo = parser.parseFile(testSet);

		assertTrue(categoryInfo.containsValue("Naming Conventions"));
	}
	
	/**
	 * Test that the parser created the right amount of warnings.
	 */
	@Test
	public void testCreateRightAmountOfWarnings() {
		GDCParser parser = new GDCParser();

		HashMap<String, String> categoryInfo = parser.parseFile(testSet);

		assertSame(2, categoryInfo.size());
	}	

//	/**
//	 * Test that the parser parse the wrong file.
//	 */
//	@Test
//	public void testParseTheWrongFile() {
//		FindBugsXMLParser parser = new FindBugsXMLParser();
//		
//		String testSet3 = "./resources/ex.xml";
//
//		List<Warning> warnings = parser.parseFile(testSet3);
//		
//		assertNotSame(6, warnings.toString());
//	}

}

@@ -49,16 +49,62 @@
 shMap;%0A%0A
+import static org.junit.Assert.assertNotSame;%0A
 import s
@@ -1020,17 +1020,13 @@
 %7D%09%0A%0A
-//
 %09/**%0A
-//
 %09 * 
@@ -1072,26 +1072,20 @@
 le.%0A
-//
 %09 */%0A
-//
 %09@Test%0A
-//
 %09pub
@@ -1123,23 +1123,13 @@
 ) %7B%0A
-//%09%09FindBugsXML
+%09%09GDC
 Pars
@@ -1148,19 +1148,11 @@
 new 
-FindBugsXML
+GDC
 Pars
@@ -1157,23 +1157,19 @@
 rser();%0A
-//
 %09%09%0A
-//
 %09%09String
@@ -1206,24 +1206,30 @@
 l%22;%0A
-//%0A//%09%09List%3CWarn
+%0A%09%09HashMap%3CString, Str
 ing%3E
@@ -1272,15 +1272,11 @@
 3);%0A
-//
 %09%09%0A
-//
 %09%09as
@@ -1303,23 +1303,17 @@
 ngs.
-toString
+size
 ());%0A
-//
 %09%7D%0A%0A

test edge case for GDC Parser