Author: julien(a)jboss.com
Date: 2007-10-03 17:17:10 -0400 (Wed, 03 Oct 2007)
New Revision: 8520
Added:
modules/test/trunk/unit/src/main/org/jboss/test/unit/info/
modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleParameterInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/ParameterInfo.java
Log:
added a simple implementation of the test info interfaces
Modified: modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-03 04:07:22
UTC (rev 8519)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/AllTests.java 2007-10-03 21:17:10
UTC (rev 8520)
@@ -31,6 +31,7 @@
import org.jboss.test.unit.runner.event.TestRunnerEventBroadcasterSupportTests;
import org.jboss.test.unit.runner.event.TestRunnerLifeCycleFilterTests;
import org.jboss.test.unit.runner.model.ModelTests;
+import org.jboss.test.unit.info.InfoTests;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,6 +54,9 @@
ParametrizationTests.main(args);
//
+ InfoTests.main(args);
+
+ //
BlahTests.main(args);
}
}
Added: modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java
(rev 0)
+++ modules/test/trunk/unit/src/main/org/jboss/test/unit/info/InfoTests.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -0,0 +1,294 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.test.unit.info;
+
+import org.jboss.unit.info.impl.SimpleParameterInfo;
+import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import org.jboss.unit.info.ParameterInfo;
+import org.jboss.unit.info.TestCaseInfo;
+import org.jboss.unit.info.TestSuiteInfo;
+
+import static org.jboss.unit.api.Assert.*;
+import static org.jboss.unit.util.CollectionTools.*;
+
+import java.util.List;
+import java.util.Collections;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InfoTests
+{
+
+ public static void main(String[] args)
+ {
+ testParameterInfo();
+ testTestCaseInfo();
+ testSuiteInfo();
+ }
+
+ private static void testParameterInfo()
+ {
+ try
+ {
+ new SimpleParameterInfo((String)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new SimpleParameterInfo((ParameterInfo)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test initial state
+ SimpleParameterInfo parameter = new SimpleParameterInfo("abc");
+ assertEquals("abc", parameter.getName());
+ assertEquals(null, parameter.getDescription());
+ assertEquals(list(), parameter.getDefaultValues());
+ parameter.setDescription("desc");
+ assertEquals("desc", parameter.getDescription());
+
+ // Try corruption
+ try
+ {
+ parameter.setDefaultValues(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test update
+ List<String> values = list("v1", "v2");
+ parameter.setDefaultValues(values);
+ assertEquals(list("v1", "v2"), parameter.getDefaultValues());
+ values.add("v3");
+ assertEquals(list("v1", "v2"), parameter.getDefaultValues());
+
+ // Test cloning
+ SimpleParameterInfo copy = new SimpleParameterInfo(parameter);
+ assertEquals("abc", copy.getName());
+ assertEquals("desc", copy.getDescription());
+ assertEquals(list("v1", "v2"), copy.getDefaultValues());
+ parameter.setDefaultValues(list("v4"));
+ parameter.setDescription(null);
+ assertEquals("abc", copy.getName());
+ assertEquals("desc", copy.getDescription());
+ assertEquals(list("v1", "v2"), copy.getDefaultValues());
+ }
+
+ private static void testTestCaseInfo()
+ {
+ try
+ {
+ new SimpleTestCaseInfo((String)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new SimpleTestCaseInfo((TestCaseInfo)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test initial state
+ SimpleTestCaseInfo testCase = new SimpleTestCaseInfo("my_test_case");
+ assertEquals("my_test_case", testCase.getName());
+ assertEquals(null, testCase.getDescription());
+ assertEquals(set(), testCase.getKeywords());
+ assertEquals(Collections.emptyMap(), testCase.getParameters());
+
+ // Test corruption
+ try
+ {
+ testCase.setKeywords(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ testCase.getKeywords().clear();
+ fail();
+ }
+ catch (UnsupportedOperationException e)
+ {
+ }
+ try
+ {
+ testCase.setParameters(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ testCase.getParameters().clear();
+ fail();
+ }
+ catch (UnsupportedOperationException e)
+ {
+ }
+
+ // Test update
+ testCase.setDescription("desc");
+ assertEquals("desc", testCase.getDescription());
+ Map<String, ParameterInfo> newParameters = new HashMap<String,
ParameterInfo>();
+ newParameters.put("foo", new SimpleParameterInfo("foo"));
+ testCase.setParameters(newParameters);
+ newParameters.clear();
+ Map<String, ? extends ParameterInfo> parameters = testCase.getParameters();
+ assertNotNull(parameters);
+ assertEquals(1, parameters.size());
+ ParameterInfo fooParameter = parameters.get("foo");
+ assertNotNull(fooParameter);
+ assertEquals("foo", fooParameter.getName());
+
+ // Test cloning
+ }
+
+ private static void testSuiteInfo()
+ {
+ try
+ {
+ new SimpleTestSuiteInfo((String)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new SimpleTestSuiteInfo((TestSuiteInfo)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test initial state
+ SimpleTestSuiteInfo testSuite = new
SimpleTestSuiteInfo("my_test_suite");
+ assertEquals("my_test_suite", testSuite.getName());
+ assertEquals(null, testSuite.getDescription());
+ assertEquals(set(), testSuite.getKeywords());
+ assertEquals(Collections.emptyMap(), testSuite.getParameters());
+ assertEquals(Collections.emptySet(), testSuite.getNames());
+
+ // Test corruption
+ try
+ {
+ testSuite.setKeywords(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ testSuite.getKeywords().clear();
+ fail();
+ }
+ catch (UnsupportedOperationException e)
+ {
+ }
+ try
+ {
+ testSuite.setParameters(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ testSuite.getParameters().clear();
+ fail();
+ }
+ catch (UnsupportedOperationException e)
+ {
+ }
+ try
+ {
+ testSuite.getNames().clear();
+ fail();
+ }
+ catch (UnsupportedOperationException e)
+ {
+ }
+ try
+ {
+ testSuite.addTest(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ testSuite.removeTest(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ // Test update
+ SimpleTestCaseInfo fooTestCase = new SimpleTestCaseInfo("foo");
+ testSuite.addTest(fooTestCase);
+ assertEquals(set("foo"), testSuite.getNames());
+ TestCaseInfo fooTestCase2 = assertInstanceOf(testSuite.getTest("foo"),
TestCaseInfo.class);
+ assertEquals("foo", fooTestCase2.getName());
+ assertEquals(null, fooTestCase2.getDescription());
+ fooTestCase.setDescription("blah");
+ assertEquals(null, fooTestCase2.getDescription());
+
+
+ // Test cloning
+ TestSuiteInfo clone = new SimpleTestSuiteInfo(testSuite);
+ assertEquals("my_test_suite", clone.getName());
+ assertEquals(set("foo"), testSuite.getNames());
+ TestCaseInfo fooTestCase3 = assertInstanceOf(clone.getTest("foo"),
TestCaseInfo.class);
+ assertEquals("foo", fooTestCase3.getName());
+ assertEquals(null, fooTestCase3.getDescription());
+ testSuite.removeTest("foo");
+ assertEquals(set(), testSuite.getNames());
+ assertEquals(set("foo"), clone.getNames());
+ }
+}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/info/ParameterInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/ParameterInfo.java 2007-10-03
04:07:22 UTC (rev 8519)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/info/ParameterInfo.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -40,15 +40,17 @@
String getName();
/**
- * The parameter description.
+ * The parameter description or null if no description is available.
*
* @return the description
*/
String getDescription();
/**
- * Return the list of values that should be used for the test.
- * @return
+ * Return the list of values that should be used for the test, if no default values
are available
+ * it returns an empty list.
+ *
+ * @return the list of default values
*/
List<String> getDefaultValues();
Added: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleParameterInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleParameterInfo.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleParameterInfo.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.info.impl;
+
+import org.jboss.unit.info.ParameterInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleParameterInfo implements ParameterInfo
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private String description;
+
+ /** . */
+ private List<String> defaultValues;
+
+ public SimpleParameterInfo(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ this.name = name;
+ this.description = null;
+ this.defaultValues = new ArrayList<String>();
+ }
+
+ public SimpleParameterInfo(ParameterInfo that)
+ {
+ if (that == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ this.name = that.getName();
+ this.description = that.getDescription();
+ this.defaultValues = new ArrayList<String>(that.getDefaultValues());
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public List<String> getDefaultValues()
+ {
+ return Collections.unmodifiableList(defaultValues);
+ }
+
+ public void setDefaultValues(List<String> defaultValues)
+ {
+ if (defaultValues == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.defaultValues = new ArrayList<String>(defaultValues);
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.info.impl;
+
+import org.jboss.unit.info.TestCaseInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleTestCaseInfo extends SimpleTestInfo implements TestCaseInfo
+{
+ public SimpleTestCaseInfo(String name)
+ {
+ super(name);
+ }
+
+ public SimpleTestCaseInfo(TestCaseInfo that)
+ {
+ super(that);
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestInfo.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -0,0 +1,137 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.info.impl;
+
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.ParameterInfo;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class SimpleTestInfo implements TestInfo
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private String description;
+
+ /** . */
+ private Map<String, SimpleParameterInfo> parameters;
+
+ /** . */
+ private Set<String> keywords;
+
+ public SimpleTestInfo(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.name = name;
+ this.description = null;
+ this.parameters = new HashMap<String, SimpleParameterInfo>();
+ this.keywords = new HashSet<String>();
+ }
+
+ public SimpleTestInfo(TestInfo that)
+ {
+ if (that == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Map<String, SimpleParameterInfo> parameters = new HashMap<String,
SimpleParameterInfo>();
+ for (Map.Entry<String, ? extends ParameterInfo> entry :
that.getParameters().entrySet())
+ {
+ parameters.put(entry.getKey(), new SimpleParameterInfo(entry.getValue()));
+ }
+
+ //
+ this.name = that.getName();
+ this.description = that.getDescription();
+ this.keywords = new HashSet<String>(that.getKeywords());
+ this.parameters = parameters;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public Map<String, ? extends ParameterInfo> getParameters()
+ {
+ return Collections.unmodifiableMap(parameters);
+ }
+
+ public void setParameters(Map<String, ? extends ParameterInfo> parameters)
+ {
+ if (parameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Map<String, SimpleParameterInfo> tmp = new HashMap<String,
SimpleParameterInfo>();
+ for (Map.Entry<String, ? extends ParameterInfo> entry :
parameters.entrySet())
+ {
+ tmp.put(entry.getKey(), new SimpleParameterInfo(entry.getValue()));
+ }
+ this.parameters = tmp;
+ }
+
+ public Set<String> getKeywords()
+ {
+ return Collections.unmodifiableSet(keywords);
+ }
+
+ public void setKeywords(Set<String> keywords)
+ {
+ if (keywords == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.keywords = new HashSet<String>(keywords);
+ }
+}
Added: modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-03
21:17:10 UTC (rev 8520)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.info.impl;
+
+import org.jboss.unit.info.TestSuiteInfo;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.TestCaseInfo;
+import org.jboss.unit.TestId;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleTestSuiteInfo extends SimpleTestInfo implements TestSuiteInfo
+{
+
+ private Map<String, SimpleTestInfo> tests;
+
+ public SimpleTestSuiteInfo(String name)
+ {
+ super(name);
+
+ //
+ this.tests = new HashMap<String, SimpleTestInfo>();
+ }
+
+ public SimpleTestSuiteInfo(TestSuiteInfo that)
+ {
+ super(that);
+
+ //
+ this.tests = new HashMap<String, SimpleTestInfo>();
+
+ //
+ for (String testName : that.getNames())
+ {
+ TestInfo test = that.getTest(testName);
+ addTest(test);
+ }
+ }
+
+ public TestInfo getTest(String name)
+ {
+ return tests.get(name);
+ }
+
+ public Set<String> getNames()
+ {
+ return Collections.unmodifiableSet(tests.keySet());
+ }
+
+ public TestInfo findTest(TestId id)
+ {
+ return null;
+ }
+
+ public void addTest(TestInfo test)
+ {
+ if (test == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ tests.put(test.getName(), create(test));
+ }
+
+ public void removeTest(String testName)
+ {
+ if (testName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ tests.remove(testName);
+ }
+
+ private SimpleTestInfo create(TestInfo test)
+ {
+ if (test instanceof TestSuiteInfo)
+ {
+ TestSuiteInfo testSuite = (TestSuiteInfo)test;
+ return new SimpleTestSuiteInfo(testSuite);
+ }
+ else
+ {
+ TestCaseInfo testCase = (TestCaseInfo)test;
+ return new SimpleTestCaseInfo(testCase);
+ }
+ }
+}