Index: trunk/quest-plugin-jfc-test/src/test/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculatorTest.java
===================================================================
--- trunk/quest-plugin-jfc-test/src/test/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculatorTest.java	(revision 797)
+++ trunk/quest-plugin-jfc-test/src/test/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculatorTest.java	(revision 806)
@@ -26,4 +26,6 @@
 import de.ugoe.cs.quest.plugin.jfc.guimodel.JFCGUIElement;
 import de.ugoe.cs.quest.plugin.jfc.guimodel.JFCGUIElementSpec;
+import de.ugoe.cs.quest.plugin.mfc.eventcore.MFCEventType;
+import de.ugoe.cs.quest.plugin.mfc.guimodel.MFCToolBar;
 import de.ugoe.cs.util.console.TextConsole;
 
@@ -34,6 +36,4 @@
  * @pattern JUnit Test Case
  *
- * @generatedBy CodePro at 7/30/12 4:50 PM
- *
  * @author fabian.glaser
  *
@@ -41,4 +41,6 @@
  */
 public class JFCReplayIDCalculatorTest extends TestCase {
+	
+	Set<String> knownIDs = new HashSet<String>();
 
 	/**
@@ -107,5 +109,6 @@
 	
 	/**
-	 * Run the String calculateReplayID(List<JFCGUIElementSpec>) method test.
+	 * Method to test if calculated IDs are included in guitar efg file.
+	 * If not more than 75 % can be matched, test fails. 
 	 *
 	 * @throws Exception
@@ -115,29 +118,6 @@
 		throws Exception {
 		// generate list of known replayIDs from guitar efg file
-		File guiFile = new File(ClassLoader.getSystemResource("freemind.efg").getFile());
-		
-		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-		DocumentBuilder builder = factory.newDocumentBuilder();
-		Document freemindGUI = builder.parse(guiFile);
-		
-		Node currentNode = freemindGUI.getFirstChild().getFirstChild();
-		NodeList eventNodes = null;
-		List<String> knownIDs = new ArrayList<String>();
-		
-		while ((currentNode = currentNode.getNextSibling()) != null){
-			if (currentNode.getNodeName().equals("Events"))
-				eventNodes = currentNode.getChildNodes();
-		}
-		
-		for (int i = 0; i < eventNodes.getLength(); i++){
-			if (eventNodes.item(i).getNodeName().equals("Event")){
-				NodeList attributes = eventNodes.item(i).getChildNodes();
-				for (int j = 0; j < attributes.getLength(); j++){
-					if (attributes.item(j).getNodeName().equals("EventId")){
-						knownIDs.add(attributes.item(j).getTextContent());
-					}
-				}
-			}
-		}
+		File guiFile = new File(ClassLoader.getSystemResource("freemind.xml").getFile());
+		JFCReplayIDValidator validator = new JFCReplayIDValidator(guiFile);
 		
 		// calculate replayIDs from trace file
@@ -145,6 +125,6 @@
 		ignoredEvents.add(JFCEventId.FOCUS_GAINED);
 		JFCLogParser parser = new JFCLogParser(ignoredEvents);
-		parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace2.xml").getFile()));
-		JFCReplayIDCalculator calculator = new JFCReplayIDCalculator();
+		parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace3.xml").getFile()));
+		JFCReplayIDCalculator calculator = new JFCReplayIDCalculator(validator);
 		
 		Set<String> generatedIDs = new HashSet<String>(); 
@@ -153,5 +133,4 @@
 		
 		assertTrue(sequences.size() > 0);
-		
 		
 		for (List<Event> currentSequence: sequences){
@@ -160,4 +139,5 @@
 				generatedIDs.add(replayID);
 				System.out.println("Generated ID: " + replayID);
+				System.out.println();
 			}
 		}
@@ -168,5 +148,5 @@
 		int known = 0;
 		for (String replayID: generatedIDs){
-			if (knownIDs.contains(replayID)){
+			if (validator.validateReplayID("w" + replayID.substring(1))){
 				System.out.println(replayID + "\t is known.");
 				known++;
@@ -180,7 +160,25 @@
 		System.out.println(percentage + "% of the generated IDs are known.");
 		
-		assertTrue(percentage > 75);
-		
-		
+		assertTrue(percentage > 75);	
+	}
+	
+	
+	/**
+	 * Method to test if calculateReplayID throws the right exception when
+	 * it is called with a target of the wrong type.
+	 */
+	@Test
+	public void testCalculateReplayIDIllegalArgumentException(){
+		try{
+			JFCReplayIDCalculator calculator = new JFCReplayIDCalculator();
+			Event event = new Event(new MFCEventType(null), new MFCToolBar(null, null));
+			
+			calculator.calculateReplayID(event);
+		
+			fail("Expected IllegalArgumentException!");
+		}
+		catch(IllegalArgumentException e){
+			System.out.println("Expected exception thrown.");
+		}
 	}
 
