[java-opensaml COMMIT] in /trunk: opensaml-core/src/main/java/org/opensaml/xml/util/ValueTypeIndexedMap.java opensaml...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Sep 21 14:18:37 BST 2011
Author: lajoie
Date: Wed Sep 21 14:18:37 2011
New Revision: 2899
URL: http://svn.shibboleth.net/view/java-opensaml?rev=2899&view=rev
Log:
Move ValueTypeIndexedMapTest to util module
Remove old ValueTypeIndexedMap
Added:
trunk/opensaml-util/src/test/java/org/opensaml/util/collections/ValueTypeIndexedMapTest.java (contents, props changed)
- copied, changed from r2889, trunk/opensaml-core/src/test/java/org/opensaml/xml/util/ValueTypeIndexedMapTest.java
Removed:
trunk/opensaml-core/src/main/java/org/opensaml/xml/util/ValueTypeIndexedMap.java
trunk/opensaml-core/src/test/java/org/opensaml/xml/util/ValueTypeIndexedMapTest.java
Modified:
trunk/opensaml-util/src/main/java/org/opensaml/util/collections/ValueTypeIndexedMap.java
Modified: trunk/opensaml-util/src/main/java/org/opensaml/util/collections/ValueTypeIndexedMap.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/main/java/org/opensaml/util/collections/ValueTypeIndexedMap.java?rev=2899&r1=2898&r2=2899&view=diff
==============================================================================
--- trunk/opensaml-util/src/main/java/org/opensaml/util/collections/ValueTypeIndexedMap.java (original)
+++ trunk/opensaml-util/src/main/java/org/opensaml/util/collections/ValueTypeIndexedMap.java Wed Sep 21 14:18:37 2011
@@ -42,7 +42,7 @@
private Map<KeyType, ValueType> map;
/** Set of valid types for this map. */
- private Set<Class<?>> types;
+ private Set<Class> types;
/** Constructor. */
public ValueTypeIndexedMap() {
@@ -57,7 +57,7 @@
*/
public ValueTypeIndexedMap(final Map<KeyType, ValueType> newMap, final Collection<Class<?>> newTypes) {
map = newMap;
- types = new HashSet<Class<?>>(newTypes);
+ types = new HashSet<Class>(newTypes);
index = new HashMap<Class<?>, Map<KeyType, ValueType>>();
rebuildIndex();
}
@@ -102,7 +102,7 @@
*
* @return which value types are indexed
*/
- public Set<Class<?>> getTypes() {
+ public Set<Class> getTypes() {
return types;
}
@@ -200,8 +200,8 @@
*
* @param newTypes which value types are indexed
*/
- public void setTypes(final Collection<Class<?>> newTypes) {
- types = new HashSet<Class<?>>(newTypes);
+ public void setTypes(final Collection<Class> newTypes) {
+ types = new HashSet<Class>(newTypes);
}
/** {@inheritDoc} */
Copied: trunk/opensaml-util/src/test/java/org/opensaml/util/collections/ValueTypeIndexedMapTest.java (from r2889, trunk/opensaml-core/src/test/java/org/opensaml/xml/util/ValueTypeIndexedMapTest.java)
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/test/java/org/opensaml/util/collections/ValueTypeIndexedMapTest.java?p2=trunk/opensaml-util/src/test/java/org/opensaml/util/collections/ValueTypeIndexedMapTest.java&p1=trunk/opensaml-core/src/test/java/org/opensaml/xml/util/ValueTypeIndexedMapTest.java&r1=2889&r2=2899&rev=2899&view=diff
==============================================================================
--- trunk/opensaml-core/src/test/java/org/opensaml/xml/util/ValueTypeIndexedMapTest.java (original)
+++ trunk/opensaml-util/src/test/java/org/opensaml/util/collections/ValueTypeIndexedMapTest.java Wed Sep 21 14:18:37 2011
@@ -15,21 +15,24 @@
* limitations under the License.
*/
-package org.opensaml.xml.util;
+package org.opensaml.util.collections;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
/**
* Tests the ValueTypeIndexedMap.
*/
-public class ValueTypeIndexedMapTest extends TestCase {
+public class ValueTypeIndexedMapTest {
/** Instance used for testing. */
private ValueTypeIndexedMap<String, Object> map;
/** {@inheritDoc} */
+ @BeforeMethod
public void setUp() {
map = new ValueTypeIndexedMap<String, Object>();
map.setTypes(Arrays.asList(new Class[] {Integer.class, String.class}));
@@ -39,70 +42,73 @@
/**
* Test basic functionality.
*/
+ @Test
public void testBasic() {
map.put("i1", Integer.parseInt("4"));
map.put("s1", "first string");
map.put("s2", "second string");
- assertEquals(3, map.size());
- assertEquals(1, map.subMap(Integer.class).size());
- assertEquals(2, map.subMap(String.class).size());
-
+ Assert.assertEquals(map.size(), 3);
+ Assert.assertEquals(map.subMap(Integer.class).size(), 1);
+ Assert.assertEquals(map.subMap(String.class).size(), 2);
+
map.remove("s1");
- assertEquals(2, map.size());
- assertEquals(1, map.subMap(Integer.class).size());
- assertEquals(1, map.subMap(String.class).size());
+ Assert.assertEquals(map.size(), 2);
+ Assert.assertEquals(map.subMap(Integer.class).size(), 1);
+ Assert.assertEquals(map.subMap(String.class).size(), 1);
}
/**
* Test null key support.
*/
+ @Test
[... 75 lines stripped ...]
More information about the commits
mailing list