Index: /trunk/EventBenchCoreTest/.classpath
===================================================================
--- /trunk/EventBenchCoreTest/.classpath	(revision 257)
+++ /trunk/EventBenchCoreTest/.classpath	(revision 257)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="/EventBenchCore"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JavaHelperLib"/>
+	<classpathentry kind="lib" path="/Build/lib/collections-generic-4.01.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/colt-1.2.0.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/commons-codec-1.5.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/concurrent-1.3.4.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/j3d-core-1.3.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/Jama-1.0.2.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-3d-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-3d-demos-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-algorithms-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-api-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-graph-impl-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-io-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-jai-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-jai-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/jung-visualization-2.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/stax-api-1.0.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/vecmath-1.3.1.jar"/>
+	<classpathentry kind="lib" path="/Build/lib/wstx-asl-3.2.6.jar"/>
+	<classpathentry kind="lib" path="libs/junit-addons-1.4.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="src" path="/JavaHelperLibTest"/>
+	<classpathentry kind="lib" path="/JavaHelperLibTest/libs/junit-addons-1.4.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Index: /trunk/EventBenchCoreTest/.project
===================================================================
--- /trunk/EventBenchCoreTest/.project	(revision 257)
+++ /trunk/EventBenchCoreTest/.project	(revision 257)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>EventBenchCoreTest</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: /trunk/EventBenchCoreTest/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- /trunk/EventBenchCoreTest/.settings/org.eclipse.jdt.core.prefs	(revision 257)
+++ /trunk/EventBenchCoreTest/.settings/org.eclipse.jdt.core.prefs	(revision 257)
@@ -0,0 +1,4 @@
+#Tue Oct 11 10:53:52 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/TestAll.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/TestAll.java	(revision 257)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/TestAll.java	(revision 257)
@@ -0,0 +1,32 @@
+package de.ugoe.cs.eventbench;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all
+ * of the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @generatedBy CodePro at 10/12/11 3:47 PM
+ * @author sherbold
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+	de.ugoe.cs.eventbench.models.TestAll.class,
+})
+public class TestAll {
+
+	/**
+	 * Launch the test.
+	 *
+	 * @param args the command line arguments
+	 *
+	 * @generatedBy CodePro at 10/12/11 3:47 PM
+	 */
+	public static void main(String[] args) {
+		JUnitCore.runClasses(new Class[] { TestAll.class });
+	}
+}
Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/IncompleteMemoryTest.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/IncompleteMemoryTest.java	(revision 257)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/IncompleteMemoryTest.java	(revision 257)
@@ -0,0 +1,150 @@
+package de.ugoe.cs.eventbench.models;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ * The class <code>IncompleteMemoryTest</code> contains tests for the class <code>{@link IncompleteMemory}</code>.
+ *
+ * @author Steffen Herbold
+ * @version 1.0
+ */
+public class IncompleteMemoryTest {
+
+	@Test
+	public void testIncompleteMemory_1()
+		throws Exception {
+		int length = 1;
+
+		IncompleteMemory<String> result = new IncompleteMemory<String>(length);
+
+		assertNotNull(result);
+		assertEquals(0, result.getLast(1).size());
+	}
+
+	@Test(expected = java.security.InvalidParameterException.class)
+	public void testIncompleteMemory_2()
+		throws Exception {
+		int length = 0;
+
+		new IncompleteMemory<String>(length);
+	}
+
+	@Test
+	public void testGetLast_1()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		fixture.add("2");
+		fixture.add("3");
+		int num = -1;
+
+		List<String> result = fixture.getLast(num);
+
+		assertNotNull(result);
+		assertEquals(0, result.size());
+	}
+
+	@Test
+	public void testGetLast_2()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		fixture.add("2");
+		fixture.add("3");
+		int num = 1;
+		
+		List<String> expected = new ArrayList<String>();
+		expected.add("3");
+
+		List<String> result = fixture.getLast(num);
+
+		assertNotNull(result);
+		assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetLast_3()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		fixture.add("2");
+		fixture.add("3");
+		int num = 2;
+		
+		List<String> expected = new ArrayList<String>();
+		expected.add("2");
+		expected.add("3");
+
+		List<String> result = fixture.getLast(num);
+
+		assertNotNull(result);
+		assertEquals(expected, result);
+	}
+	
+	@Test
+	public void testGetLast_4()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		fixture.add("2");
+		fixture.add("3");
+		int num = 3;
+		
+		List<String> expected = new ArrayList<String>();
+		expected.add("2");
+		expected.add("3");
+
+		List<String> result = fixture.getLast(num);
+
+		assertNotNull(result);
+		assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetLength_1()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		
+		int result = fixture.getLength(); 
+
+		assertEquals(0, result);
+	}
+	
+	@Test
+	public void testGetLength_2()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		
+		int result = fixture.getLength(); 
+
+		assertEquals(1, result);
+	}
+	
+	@Test
+	public void testGetLength_3()
+		throws Exception {
+		int length = 2;
+		IncompleteMemory<String> fixture = new IncompleteMemory<String>(length);
+		fixture.add("1");
+		fixture.add("2");
+		fixture.add("3");
+		
+		int result = fixture.getLength(); 
+
+		assertEquals(2, result);
+	}
+
+	public static void main(String[] args) {
+		new org.junit.runner.JUnitCore().run(IncompleteMemoryTest.class);
+	}
+}
Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TestAll.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TestAll.java	(revision 257)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TestAll.java	(revision 257)
@@ -0,0 +1,34 @@
+package de.ugoe.cs.eventbench.models;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all
+ * of the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @generatedBy CodePro at 10/12/11 3:47 PM
+ * @author sherbold
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+	TrieBasedModelTest.class,
+	IncompleteMemoryTest.class,
+	TrieTest.class,
+})
+public class TestAll {
+
+	/**
+	 * Launch the test.
+	 *
+	 * @param args the command line arguments
+	 *
+	 * @generatedBy CodePro at 10/12/11 3:47 PM
+	 */
+	public static void main(String[] args) {
+		JUnitCore.runClasses(new Class[] { TestAll.class });
+	}
+}
Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieBasedModelTest.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieBasedModelTest.java	(revision 257)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieBasedModelTest.java	(revision 257)
@@ -0,0 +1,570 @@
+package de.ugoe.cs.eventbench.models;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import de.ugoe.cs.eventbench.data.Event;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ * The class <code>TrieBasedModelTest</code> contains tests for the class <code>{@link TrieBasedModel}</code>.
+ *
+ * @author Steffen Herbold
+ * @version 1.0
+ */
+public class TrieBasedModelTest {
+	
+	List<Event<?>> sequence;
+	Collection<Event<?>> symbols;
+	
+	private void assertTrieStructure(Trie<Event<?>> trie, int numSequences) {
+		TrieNode<Event<?>> root = trie.find(null);
+		TrieNode<Event<?>> root_a = root.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_a_a = root_a.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_a_b = root_a.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_a_b_a = root_a_b.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_a_b_b = root_a_b.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_a_b_c = root_a_b.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_a_b_d = root_a_b.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_a_b_r = root_a_b.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_a_c = root_a.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_a_c_a = root_a_c.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_a_c_b = root_a_c.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_a_c_c = root_a_c.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_a_c_d = root_a_c.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_a_c_r = root_a_c.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_a_d = root_a.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_a_d_a = root_a_d.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_a_d_b = root_a_d.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_a_d_c = root_a_d.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_a_d_d = root_a_d.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_a_d_r = root_a_d.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_a_r = root_a.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_b = root.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_b_a = root_b.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_b_b = root_b.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_b_c = root_b.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_b_d = root_b.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_b_r = root_b.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_b_r_a = root_b_r.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_b_r_b = root_b_r.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_b_r_c = root_b_r.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_b_r_d = root_b_r.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_b_r_r = root_b_r.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_c = root.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_c_a = root_c.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_c_a_a = root_c_a.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_c_a_b = root_c_a.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_c_a_c = root_c_a.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_c_a_d = root_c_a.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_c_a_r = root_c_a.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_c_b = root_c.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_c_c = root_c.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_c_d = root_c.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_c_r = root_c.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_d = root.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_d_a = root_d.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_d_a_a = root_d_a.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_d_a_b = root_d_a.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_d_a_c = root_d_a.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_d_a_d = root_d_a.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_d_a_r = root_d_a.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_d_b = root_d.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_d_c = root_d.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_d_d = root_d.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_d_r = root_d.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_r = root.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_r_a = root_r.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_r_a_a = root_r_a.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_r_a_b = root_r_a.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_r_a_c = root_r_a.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_r_a_d = root_r_a.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_r_a_r = root_r_a.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_r_a_end = root_r_a.getChild(Event.ENDEVENT);
+		TrieNode<Event<?>> root_r_b = root_r.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_r_c = root_r.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_r_d = root_r.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_r_r = root_r.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_start = root.getChild(Event.STARTEVENT);
+		TrieNode<Event<?>> root_start_a = root_start.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_start_a_a = root_start_a.getChild(new Event<String>("a"));
+		TrieNode<Event<?>> root_start_a_b = root_start_a.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_start_a_c = root_start_a.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_start_a_d = root_start_a.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_start_a_r = root_start_a.getChild(new Event<String>("r"));
+		TrieNode<Event<?>> root_start_b = root_start.getChild(new Event<String>("b"));
+		TrieNode<Event<?>> root_start_c = root_start.getChild(new Event<String>("c"));
+		TrieNode<Event<?>> root_start_d = root_start.getChild(new Event<String>("d"));
+		TrieNode<Event<?>> root_start_r = root_start.getChild(new Event<String>("r"));
+		
+		assertEquals(numSequences*5, root_a.getCount());
+		assertNull(root_a_a);
+		assertEquals(numSequences*2, root_a_b.getCount());
+		assertNull(root_a_b_a);
+		assertNull(root_a_b_b);
+		assertNull(root_a_b_c);
+		assertNull(root_a_b_d);
+		assertEquals(numSequences*2, root_a_b_r.getCount());
+		assertEquals(numSequences*1, root_a_c.getCount());
+		assertEquals(numSequences*1, root_a_c_a.getCount());
+		assertNull(root_a_c_b);
+		assertNull(root_a_c_c);
+		assertNull(root_a_c_d);
+		assertNull(root_a_c_r);
+		assertEquals(numSequences*1, root_a_d.getCount());
+		assertEquals(numSequences*1, root_a_d_a.getCount());
+		assertNull(root_a_d_b);
+		assertNull(root_a_d_c);
+		assertNull(root_a_d_d);
+		assertNull(root_a_d_r);
+		assertNull(root_a_r);
+		
+		assertEquals(numSequences*2, root_b.getCount());
+		assertNull(root_b_a);
+		assertNull(root_b_b);
+		assertNull(root_b_c);
+		assertNull(root_b_d);
+		assertEquals(numSequences*2, root_b_r.getCount());
+		assertEquals(numSequences*2, root_b_r_a.getCount());
+		assertNull(root_b_r_b);
+		assertNull(root_b_r_c);
+		assertNull(root_b_r_d);
+		assertNull(root_b_r_r);
+		
+		assertEquals(numSequences*1, root_c.getCount());
+		assertEquals(numSequences*1, root_c_a.getCount());
+		assertNull(root_c_a_a);
+		assertNull(root_c_a_b);
+		assertNull(root_c_a_c);
+		assertEquals(numSequences*1, root_c_a_d.getCount());
+		assertNull(root_c_a_r);
+		assertNull(root_c_b);
+		assertNull(root_c_c);
+		assertNull(root_c_d);
+		assertNull(root_c_r);
+		
+		assertEquals(numSequences*1, root_d.getCount());
+		assertEquals(numSequences*1, root_d_a.getCount());
+		assertNull(root_d_a_a);
+		assertEquals(numSequences*1, root_d_a_b.getCount());
+		assertNull(root_d_a_c);
+		assertNull(root_d_a_d);
+		assertNull(root_d_a_r);
+		assertNull(root_d_b);
+		assertNull(root_d_c);
+		assertNull(root_d_d);
+		assertNull(root_d_r);
+		
+		assertEquals(numSequences*2, root_r.getCount());
+		assertEquals(numSequences*2, root_r_a.getCount());
+		assertNull(root_r_a_a);
+		assertNull(root_r_a_b);
+		assertEquals(numSequences*1, root_r_a_c.getCount());
+		assertNull(root_r_a_d);
+		assertNull(root_r_a_r);
+		assertEquals(numSequences*1, root_r_a_end.getCount());
+		assertNull(root_r_b);
+		assertNull(root_r_c);
+		assertNull(root_r_d);
+		assertNull(root_r_r);
+		
+		assertEquals(numSequences*1, root_start.getCount());
+		assertEquals(numSequences*1, root_start_a.getCount());
+		assertNull(root_start_a_a);
+		assertEquals(numSequences*1, root_start_a_b.getCount());
+		assertNull(root_start_a_c);
+		assertNull(root_start_a_d);
+		assertNull(root_start_a_r);
+		assertNull(root_start_b);
+		assertNull(root_start_c);
+		assertNull(root_start_d);
+		assertNull(root_start_r);
+		
+		// check if leafs are really leafs
+		assertTrue(root_a_b_r.isLeaf());
+		assertTrue(root_a_c_a.isLeaf());
+		assertTrue(root_a_d_a.isLeaf());
+		assertTrue(root_b_r_a.isLeaf());
+		assertTrue(root_c_a_d.isLeaf());
+		assertTrue(root_d_a_b.isLeaf());
+		assertTrue(root_r_a_c.isLeaf());
+		assertTrue(root_r_a_end.isLeaf());
+	}
+	
+	private static void assertCollectionContent(Collection<?> c1, Collection<?> c2) {
+		assertEquals(c1.size(), c2.size());
+		for( Object obj : c1 ) {
+			assertTrue(c2.contains(obj));
+		}
+	}
+	
+	private class MockTrieBasedModel extends TrieBasedModel {
+		private static final long serialVersionUID = 1L;
+
+		public MockTrieBasedModel(int markovOrder, Random r) {
+			super(markovOrder, r);
+		}
+
+		@Override
+		public double getProbability(List<? extends Event<?>> context,
+				Event<?> symbol) {
+			List<Event<?>> list = new ArrayList<Event<?>>();
+			list.add(context.get(context.size()-1));
+			if( trie.find(list).getFollowingSymbols().contains(symbol) ) {
+				return 1;
+			} else {
+				return 0;
+			}
+		}
+	}
+	
+	@Test
+	public void testGenerateSequences_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		int length = 2;
+		
+		Collection<List<Event<?>>> expected = new HashSet<List<Event<?>>>();
+		ArrayList<Event<?>> list;
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("a"));
+		list.add(Event.ENDEVENT);
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("b"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("c"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("d"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("b"));
+		list.add(new Event<String>("r"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("c"));
+		list.add(new Event<String>("a"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("d"));
+		list.add(new Event<String>("a"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(new Event<String>("r"));
+		list.add(new Event<String>("a"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		expected.add(list);
+
+		
+		Collection<List<? extends Event<?>>> result = fixture.generateSequences(length);
+
+		assertCollectionContent(expected, result);
+	}
+
+	@Test
+	public void testGenerateSequences_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		int length = 3;
+		
+		Collection<List<Event<?>>> expected = new HashSet<List<Event<?>>>();
+		ArrayList<Event<?>> list;
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(Event.ENDEVENT);
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("b"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("c"));
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("d"));
+		expected.add(list);
+
+		Collection<List<? extends Event<?>>> result = fixture.generateSequences(length, true);
+
+		assertCollectionContent(expected, result);
+	}
+
+	@Test( expected = java.security.InvalidParameterException.class )
+	public void testGenerateSequences_3()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		int length = 0;
+
+		fixture.generateSequences(length, false);
+	}
+
+	@Test
+	public void testGenerateValidSequences_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		int length = 5;
+		
+		Collection<List<Event<?>>> expected = new HashSet<List<Event<?>>>();
+		ArrayList<Event<?>> list;
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("c"));
+		list.add(new Event<String>("a"));
+		list.add(Event.ENDEVENT);
+		expected.add(list);
+		list = new ArrayList<Event<?>>();
+		list.add(Event.STARTEVENT);
+		list.add(new Event<String>("a"));
+		list.add(new Event<String>("d"));
+		list.add(new Event<String>("a"));
+		list.add(Event.ENDEVENT);
+		expected.add(list);
+
+		Collection<List<? extends Event<?>>> result = fixture.generateValidSequences(length);
+
+		assertCollectionContent(expected, result);
+	}
+
+	@Test(expected = java.security.InvalidParameterException.class )
+	public void testGenerateValidSequences_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		int length = 0;
+
+		fixture.generateValidSequences(length);
+	}
+	
+	@Test
+	public void testGetEvents_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+
+		fixture.train(sequences);
+
+		Collection<? extends Event<?>> result = fixture.getEvents();
+
+		assertCollectionContent(symbols, result);
+	}
+	
+	@Test
+	public void testGetEvents_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		
+		Collection<? extends Event<?>> result = fixture.getEvents();
+
+		assertCollectionContent(new HashSet<Event<?>>(), result);
+	}
+
+	@Test
+	public void testGetNumFOMStates_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+
+		fixture.train(sequences);
+
+		int result = fixture.getNumFOMStates();
+
+		assertEquals(10, result);
+	}
+	
+	@Test
+	public void testGetNumFOMStates_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());;
+
+		int result = fixture.getNumFOMStates();
+
+		assertEquals(0, result);
+	}
+	
+	@Test
+	public void testGetNumSymbols_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+
+		int result = fixture.getNumSymbols();
+
+		assertEquals(7, result);
+	}
+	
+	@Test
+	public void testGetNumSymbols_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+
+		int result = fixture.getNumSymbols();
+
+		assertEquals(0, result);
+	}
+
+	@Test
+	public void testGetNumTransitions_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		
+		int result = fixture.getNumTransitions();
+
+		assertEquals(11, result);
+	}
+	
+	@Test
+	public void testGetNumTransitions_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());	
+
+		int result = fixture.getNumTransitions();
+
+		assertEquals(0, result);
+	}
+
+	@Test
+	public void testTrain_1 ()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+
+		fixture.train(sequences);
+		
+		assertCollectionContent(symbols, fixture.getEvents());
+		
+		assertTrieStructure(fixture.trie, 1);	}
+	
+	@Test
+	public void testTrain_2 ()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		sequences.add(sequence);
+
+		fixture.train(sequences);
+		
+		assertCollectionContent(symbols, fixture.getEvents());
+		
+		assertTrieStructure(fixture.trie, 2);
+	}
+	
+	@Test
+	public void testUpdate_1()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = new ArrayList<List<Event<?>>>();
+		sequences.add(sequence);
+		fixture.train(sequences);
+		
+		fixture.update(sequences);
+
+		assertCollectionContent(symbols, fixture.getEvents());
+		assertTrieStructure(fixture.trie, 2);
+	}
+
+	@Test
+	public void testUpdate_2()
+		throws Exception {
+		int markovOrder = 2;
+		MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, new Random());
+		Collection<List<Event<?>>> sequences = null;
+		fixture.trie = null;
+
+		fixture.update(sequences);
+		
+		assertNull(fixture.trie);
+	}
+
+	@Before
+	public void setUp()
+		throws Exception {
+		sequence = new ArrayList<Event<?>>();
+		sequence.add(new Event<String>("a"));
+		sequence.add(new Event<String>("b"));
+		sequence.add(new Event<String>("r"));
+		sequence.add(new Event<String>("a"));
+		sequence.add(new Event<String>("c"));
+		sequence.add(new Event<String>("a"));
+		sequence.add(new Event<String>("d"));
+		sequence.add(new Event<String>("a"));
+		sequence.add(new Event<String>("b"));
+		sequence.add(new Event<String>("r"));
+		sequence.add(new Event<String>("a"));
+		
+		symbols = new HashSet<Event<?>>();
+		symbols.add(new Event<String>("a"));
+		symbols.add(new Event<String>("b"));
+		symbols.add(new Event<String>("c"));
+		symbols.add(new Event<String>("d"));
+		symbols.add(new Event<String>("r"));
+		symbols.add(Event.STARTEVENT);
+		symbols.add(Event.ENDEVENT);
+	}
+
+	@After
+	public void tearDown()
+		throws Exception {
+		// Add additional tear down code here
+	}
+
+	public static void main(String[] args) {
+		new org.junit.runner.JUnitCore().run(TrieBasedModelTest.class);
+	}
+}
Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java	(revision 257)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java	(revision 257)
@@ -0,0 +1,643 @@
+package de.ugoe.cs.eventbench.models;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import junitx.framework.ListAssert;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ * The class <code>TrieTest</code> contains tests for the class <code>{@link Trie}</code>.
+ *
+ * @author Steffen Herbold
+ * @version 1.0
+ */
+public class TrieTest {
+	
+	List<String> sequence;
+	Collection<String> symbols;
+	
+	private static void assertCollectionContent(Collection<?> c1, Collection<?> c2) {
+		assertEquals(c1.size(), c2.size());
+		for( Object obj : c1 ) {
+			assertTrue(c2.contains(obj));
+		}
+	}
+	
+	@Test
+	public void testTrie_1()
+		throws Exception {
+
+		Trie<String> result = new Trie<String>();
+
+		assertNotNull(result);
+		assertEquals(0, result.getNumLeafs());
+		assertEquals(0, result.getNumSymbols());
+		assertEquals(0, result.getNumLeafAncestors());
+		assertTrue(result.getKnownSymbols().isEmpty());
+	}
+
+	@Test
+	public void testAdd_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		List<String> seq = new ArrayList<String>();
+		seq.add("a");
+		seq.add("b");
+		
+		fixture.add(seq);
+		
+		assertEquals(1, fixture.getChild("a").getCount());
+		assertEquals(1, fixture.getChild("a").getChild("b").getCount());
+		assertNull(fixture.getChild("b"));
+	}
+	
+	@Test
+	public void testAdd_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		
+		fixture.add(new ArrayList<String>());
+		
+		assertEquals(0, fixture.getNumSymbols());
+	}
+	
+	@Test
+	public void testAdd_3()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		
+		fixture.add(null);
+		
+		assertEquals(0, fixture.getNumSymbols());
+	}
+
+	@Test
+	public void testFind_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> findSequence = new ArrayList<String>();
+		findSequence.add("a");
+		findSequence.add("b");
+		findSequence.add("r");
+		TrieNode<String> expected = fixture.getChild("a").getChild("b").getChild("r");
+		
+		TrieNode<String> result = fixture.find(findSequence);
+
+		assertEquals(expected, result);
+	}
+
+	@Test
+	public void testFind_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> findSequence = new ArrayList<String>();
+		findSequence.add("c");
+		findSequence.add("a");
+		TrieNode<String> expected = fixture.getChild("c").getChild("a");
+		
+		TrieNode<String> result = fixture.find(findSequence);
+
+		assertEquals(expected, result);
+	}
+
+	@Test
+	public void testFind_3()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> findSequence = new ArrayList<String>();
+		
+		TrieNode<String> result = fixture.find(findSequence);
+
+		assertTrue(result.isRoot());
+	}
+
+	@Test
+	public void testFind_4()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		
+		TrieNode<String> result = fixture.find(null);
+
+		assertTrue(result.isRoot());
+	}
+
+	@Test
+	public void testGetChildCreate_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		String symbol = "a";
+
+		TrieNode<String> result = fixture.getChildCreate(symbol);
+
+		assertEquals(symbol, result.getSymbol());
+		assertEquals(0, result.getCount());
+		assertTrue(result.isLeaf());
+	}
+	
+	@Test(expected=java.security.InvalidParameterException.class)
+	public void testGetChildCreate_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.getChildCreate(null);
+	}
+
+	@Test
+	public void testGetContextSuffix_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> context = new ArrayList<String>();
+		context.add("a");
+		context.add("a");
+		context.add("b");
+		List<String> expected = new ArrayList<String>();
+		expected.add("a");
+		expected.add("b");
+		
+
+		List<String> result = fixture.getContextSuffix(context);
+
+		ListAssert.assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetContextSuffix_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> context = new ArrayList<String>();
+		context.add("a");
+		context.add("a");
+		context.add("b");
+		context.add("r");
+		List<String> expected = new ArrayList<String>();
+		expected.add("a");
+		expected.add("b");
+		expected.add("r");
+		
+
+		List<String> result = fixture.getContextSuffix(context);
+
+		ListAssert.assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetContextSuffix_3()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> context = new ArrayList<String>();
+		context.add("a");
+		context.add("a");
+		context.add("b");
+		context.add("x");
+		List<String> expected = new ArrayList<String>();
+
+		List<String> result = fixture.getContextSuffix(context);
+
+		ListAssert.assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetContextSuffix_4()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+
+		List<String> result = fixture.getContextSuffix(null);
+
+		// add additional test code here
+		assertNotNull(result);
+		assertEquals(0, result.size());
+	}
+
+	@Test
+	public void testGetContextSuffix_5()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> context = new ArrayList<String>();
+		context.add("a");
+		context.add("a");
+		context.add("b");
+		List<String> expected = new ArrayList<String>();
+		expected.add("a");
+		expected.add("b");
+		
+
+		List<String> result = fixture.getContextSuffix(context);
+
+		ListAssert.assertEquals(expected, result);
+	}
+
+	@Test
+	public void testGetCount_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("a");
+
+		int result = fixture.getCount(subSequence);
+
+		assertEquals(5, result);
+	}
+
+	@Test
+	public void testGetCount_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("a");
+		subSequence.add("b");
+
+		int result = fixture.getCount(subSequence);
+		
+		assertEquals(2, result);
+	}
+
+	@Test
+	public void testGetCount_3()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("x");
+
+		int result = fixture.getCount(subSequence);
+
+		assertEquals(0, result);
+	}
+	
+	@Test
+	public void testGetCount_4()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+
+		int result = fixture.getCount(subSequence, "a");
+
+		assertEquals(5, result);
+	}
+
+	@Test
+	public void testGetCount_5()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("a");
+		subSequence.add("b");
+
+		int result = fixture.getCount(subSequence, "r");
+		
+		assertEquals(2, result);
+	}
+
+	@Test
+	public void testGetCount_6()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+
+		int result = fixture.getCount(subSequence, "x");
+
+		assertEquals(0, result);
+	}
+
+	@Test
+	public void testGetFollowingSymbols_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("a");
+		Collection<String> expected = new ArrayList<String>();
+		expected.add("b");
+		expected.add("c");
+		expected.add("d");
+		
+		Collection<String> result = fixture.getFollowingSymbols(subSequence);
+
+		assertCollectionContent(expected, result);
+	}
+
+	@Test
+	public void testGetFollowingSymbols_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("a");
+		subSequence.add("b");
+		subSequence.add("r");
+
+		Collection<String> result = fixture.getFollowingSymbols(subSequence);
+
+		assertEquals(0, result.size());
+	}
+	
+	@Test
+	public void testGetFollowingSymbols_3()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+		List<String> subSequence = new ArrayList<String>();
+		subSequence.add("x");
+
+		Collection<String> result = fixture.getFollowingSymbols(subSequence);
+
+		assertEquals(0, result.size());
+	}
+	
+	@Test
+	public void testGetNumLeafAncestors_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+
+		int result = fixture.getNumLeafAncestors();
+
+		assertEquals(7, result);
+	}
+	
+	@Test
+	public void testGetNumLeafs_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+
+		int result = fixture.getNumLeafs();
+
+		assertEquals(7, result);
+	}
+	
+	@Test
+	public void testGetNumSymbols_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+
+		int result = fixture.getNumSymbols();
+
+		assertEquals(5, result);
+	}
+
+	@Test
+	public void testTrain_1()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		int maxOrder = 3;
+
+		fixture.train(sequence, maxOrder);
+		
+		// check if symbols are correct
+		assertCollectionContent(symbols, fixture.getKnownSymbols());
+		
+		// check if counters are correct and only the correct nodes exist
+		TrieNode<String> root = fixture.find(new ArrayList<String>());
+		TrieNode<String> root_a = root.getChild("a");
+		TrieNode<String> root_a_a = root_a.getChild("a");
+		TrieNode<String> root_a_b = root_a.getChild("b");
+		TrieNode<String> root_a_b_a = root_a_b.getChild("a");
+		TrieNode<String> root_a_b_b = root_a_b.getChild("b");
+		TrieNode<String> root_a_b_c = root_a_b.getChild("c");
+		TrieNode<String> root_a_b_d = root_a_b.getChild("d");
+		TrieNode<String> root_a_b_r = root_a_b.getChild("r");
+		TrieNode<String> root_a_c = root_a.getChild("c");
+		TrieNode<String> root_a_c_a = root_a_c.getChild("a");
+		TrieNode<String> root_a_c_b = root_a_c.getChild("b");
+		TrieNode<String> root_a_c_c = root_a_c.getChild("c");
+		TrieNode<String> root_a_c_d = root_a_c.getChild("d");
+		TrieNode<String> root_a_c_r = root_a_c.getChild("r");
+		TrieNode<String> root_a_d = root_a.getChild("d");
+		TrieNode<String> root_a_d_a = root_a_d.getChild("a");
+		TrieNode<String> root_a_d_b = root_a_d.getChild("b");
+		TrieNode<String> root_a_d_c = root_a_d.getChild("c");
+		TrieNode<String> root_a_d_d = root_a_d.getChild("d");
+		TrieNode<String> root_a_d_r = root_a_d.getChild("r");
+		TrieNode<String> root_a_r = root_a.getChild("r");
+		TrieNode<String> root_b = root.getChild("b");
+		TrieNode<String> root_b_a = root_b.getChild("a");
+		TrieNode<String> root_b_b = root_b.getChild("b");
+		TrieNode<String> root_b_c = root_b.getChild("c");
+		TrieNode<String> root_b_d = root_b.getChild("d");
+		TrieNode<String> root_b_r = root_b.getChild("r");
+		TrieNode<String> root_b_r_a = root_b_r.getChild("a");
+		TrieNode<String> root_b_r_b = root_b_r.getChild("b");
+		TrieNode<String> root_b_r_c = root_b_r.getChild("c");
+		TrieNode<String> root_b_r_d = root_b_r.getChild("d");
+		TrieNode<String> root_b_r_r = root_b_r.getChild("r");
+		TrieNode<String> root_c = root.getChild("c");
+		TrieNode<String> root_c_a = root_c.getChild("a");
+		TrieNode<String> root_c_a_a = root_c_a.getChild("a");
+		TrieNode<String> root_c_a_b = root_c_a.getChild("b");
+		TrieNode<String> root_c_a_c = root_c_a.getChild("c");
+		TrieNode<String> root_c_a_d = root_c_a.getChild("d");
+		TrieNode<String> root_c_a_r = root_c_a.getChild("r");
+		TrieNode<String> root_c_b = root_c.getChild("b");
+		TrieNode<String> root_c_c = root_c.getChild("c");
+		TrieNode<String> root_c_d = root_c.getChild("d");
+		TrieNode<String> root_c_r = root_c.getChild("r");
+		TrieNode<String> root_d = root.getChild("d");
+		TrieNode<String> root_d_a = root_d.getChild("a");
+		TrieNode<String> root_d_a_a = root_d_a.getChild("a");
+		TrieNode<String> root_d_a_b = root_d_a.getChild("b");
+		TrieNode<String> root_d_a_c = root_d_a.getChild("c");
+		TrieNode<String> root_d_a_d = root_d_a.getChild("d");
+		TrieNode<String> root_d_a_r = root_d_a.getChild("r");
+		TrieNode<String> root_d_b = root_d.getChild("b");
+		TrieNode<String> root_d_c = root_d.getChild("c");
+		TrieNode<String> root_d_d = root_d.getChild("d");
+		TrieNode<String> root_d_r = root_d.getChild("r");
+		TrieNode<String> root_r = root.getChild("r");
+		TrieNode<String> root_r_a = root_r.getChild("a");
+		TrieNode<String> root_r_a_a = root_r_a.getChild("a");
+		TrieNode<String> root_r_a_b = root_r_a.getChild("b");
+		TrieNode<String> root_r_a_c = root_r_a.getChild("c");
+		TrieNode<String> root_r_a_d = root_r_a.getChild("d");
+		TrieNode<String> root_r_a_r = root_r_a.getChild("r");
+		TrieNode<String> root_r_b = root_r.getChild("b");
+		TrieNode<String> root_r_c = root_r.getChild("c");
+		TrieNode<String> root_r_d = root_r.getChild("d");
+		TrieNode<String> root_r_r = root_r.getChild("r");
+		
+		assertEquals(5, root_a.getCount());
+		assertNull(root_a_a);
+		assertEquals(2, root_a_b.getCount());
+		assertNull(root_a_b_a);
+		assertNull(root_a_b_b);
+		assertNull(root_a_b_c);
+		assertNull(root_a_b_d);
+		assertEquals(2, root_a_b_r.getCount());
+		assertEquals(1, root_a_c.getCount());
+		assertEquals(1, root_a_c_a.getCount());
+		assertNull(root_a_c_b);
+		assertNull(root_a_c_c);
+		assertNull(root_a_c_d);
+		assertNull(root_a_c_r);
+		assertEquals(1, root_a_d.getCount());
+		assertEquals(1, root_a_d_a.getCount());
+		assertNull(root_a_d_b);
+		assertNull(root_a_d_c);
+		assertNull(root_a_d_d);
+		assertNull(root_a_d_r);
+		assertNull(root_a_r);
+		
+		assertEquals(2, root_b.getCount());
+		assertNull(root_b_a);
+		assertNull(root_b_b);
+		assertNull(root_b_c);
+		assertNull(root_b_d);
+		assertEquals(2, root_b_r.getCount());
+		assertEquals(2, root_b_r_a.getCount());
+		assertNull(root_b_r_b);
+		assertNull(root_b_r_c);
+		assertNull(root_b_r_d);
+		assertNull(root_b_r_r);
+		
+		assertEquals(1, root_c.getCount());
+		assertEquals(1, root_c_a.getCount());
+		assertNull(root_c_a_a);
+		assertNull(root_c_a_b);
+		assertNull(root_c_a_c);
+		assertEquals(1, root_c_a_d.getCount());
+		assertNull(root_c_a_r);
+		assertNull(root_c_b);
+		assertNull(root_c_c);
+		assertNull(root_c_d);
+		assertNull(root_c_r);
+		
+		assertEquals(1, root_d.getCount());
+		assertEquals(1, root_d_a.getCount());
+		assertNull(root_d_a_a);
+		assertEquals(1, root_d_a_b.getCount());
+		assertNull(root_d_a_c);
+		assertNull(root_d_a_d);
+		assertNull(root_d_a_r);
+		assertNull(root_d_b);
+		assertNull(root_d_c);
+		assertNull(root_d_d);
+		assertNull(root_d_r);
+		
+		assertEquals(2, root_r.getCount());
+		assertEquals(2, root_r_a.getCount());
+		assertNull(root_r_a_a);
+		assertNull(root_r_a_b);
+		assertEquals(1, root_r_a_c.getCount());
+		assertNull(root_r_a_d);
+		assertNull(root_r_a_r);
+		assertNull(root_r_b);
+		assertNull(root_r_c);
+		assertNull(root_r_d);
+		assertNull(root_r_r);
+		
+		// check if leafs are really leafs
+		assertTrue(root_a_b_r.isLeaf());
+		assertTrue(root_a_c_a.isLeaf());
+		assertTrue(root_a_d_a.isLeaf());
+		assertTrue(root_b_r_a.isLeaf());
+		assertTrue(root_c_a_d.isLeaf());
+		assertTrue(root_d_a_b.isLeaf());
+		assertTrue(root_r_a_c.isLeaf());
+	}
+
+	@Test
+	public void testTrain_2()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		int maxOrder = 0;
+
+		fixture.train(sequence, maxOrder);
+
+		assertTrue(fixture.getKnownSymbols().isEmpty());
+	}
+
+	@Test
+	public void testTrain_3()
+		throws Exception {
+		Trie<Object> fixture = new Trie<Object>();
+		List<Object> sequence = new ArrayList<Object>();
+		int maxOrder = 1;
+
+		fixture.train(sequence, maxOrder);
+		
+		assertTrue(fixture.getKnownSymbols().isEmpty());
+	}
+
+	@Test
+	public void testTrain_4()
+		throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		List<String> sequence = new ArrayList<String>();
+		sequence.add("a");
+		sequence.add("b");
+		int maxOrder = 3;
+
+		fixture.train(sequence, maxOrder);
+		
+		assertCollectionContent(sequence, fixture.getKnownSymbols());
+		TrieNode<String> root = fixture.find(new ArrayList<String>());
+		TrieNode<String> root_a = root.getChild("a");
+		TrieNode<String> root_a_a = root_a.getChild("a");
+		TrieNode<String> root_a_b = root_a.getChild("b");
+		TrieNode<String> root_b = root.getChild("b");
+		TrieNode<String> root_b_a = root_b.getChild("a");
+		TrieNode<String> root_b_b = root_b.getChild("b");
+		
+		assertEquals(1, root_a.getCount());
+		assertNull(root_a_a);
+		assertEquals(1, root_a_b.getCount());
+		assertEquals(1, root_b.getCount());
+		assertNull(root_b_a);
+		assertNull(root_b_b);
+		
+		assertTrue(root_a_b.isLeaf());
+		assertTrue(root_b.isLeaf());
+	}
+
+	@Before
+	public void setUp()
+		throws Exception {
+		sequence = new ArrayList<String>();
+		sequence.add("a");
+		sequence.add("b");
+		sequence.add("r");
+		sequence.add("a");
+		sequence.add("c");
+		sequence.add("a");
+		sequence.add("d");
+		sequence.add("a");
+		sequence.add("b");
+		sequence.add("r");
+		sequence.add("a");
+		
+		symbols = new HashSet<String>();
+		symbols.add("a");
+		symbols.add("b");
+		symbols.add("c");
+		symbols.add("d");
+		symbols.add("r");
+	}
+
+	@After
+	public void tearDown()
+		throws Exception {
+		// Add additional tear down code here
+	}
+
+	public static void main(String[] args) {
+		new org.junit.runner.JUnitCore().run(TrieTest.class);
+	}
+}
