commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1344950 [3/3] - in /commons/sandbox/classscan/trunk: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/commons/ src/main/java/org/apache/commons/classscan/ src/main/java/org/apache/commo...
Date Fri, 01 Jun 2012 00:27:41 GMT
Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/PrimitiveClassTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/PrimitiveClassTest.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/PrimitiveClassTest.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/PrimitiveClassTest.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,72 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.classscan.bcel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.net.URISyntaxException;
+
+import org.apache.commons.classscan.MetaClass;
+import org.apache.commons.classscan.MetaClassLoader;
+import org.apache.commons.classscan.MetaRegistry;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PrimitiveClassTest {
+
+    MetaClassLoader classLoader;
+    MetaClass byteClass;
+    
+    @Before
+    public void loadLocation() throws URISyntaxException {
+        classLoader = MetaRegistry.SINGLETON.getClassLoader(Byte.TYPE.getClassLoader());
+        byteClass = classLoader.getMetaClass(Byte.TYPE.getCanonicalName());
+    }
+
+    @Test
+    public void testGetClassLocation() throws URISyntaxException {
+        assertNull(byteClass.getClassLocation());
+    }
+
+    @Test
+    public void testGetCanonicalName() {
+        assertEquals(Byte.TYPE.getCanonicalName(), byteClass.getName());
+    }
+
+    @Test
+    public void testGetParent() throws URISyntaxException {
+        assertNull(byteClass.getParent());
+    }
+
+    @Test
+    public void testGetInterfaces() {
+        assertEquals(0, byteClass.getInterfaces().size());
+    }
+
+    @Test
+    public void testGetAnnotations() {
+        assertEquals(0, byteClass.getAnnotations().size());
+    }
+
+    @Test
+    public void testGetMethods() {
+        assertEquals(0, byteClass.getMethods().size());
+    }
+
+    @Test
+    public void testGetFields() {
+        assertEquals(0, byteClass.getFields().size());
+    }
+}

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/PrimitiveClassTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/UriClassLocationTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/UriClassLocationTest.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/UriClassLocationTest.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/UriClassLocationTest.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,63 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.classscan.bcel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URISyntaxException;
+import java.util.Collection;
+
+import org.apache.commons.classscan.MetaClass;
+import org.apache.commons.classscan.MetaClassLoader;
+import org.apache.commons.classscan.MetaClassLocation;
+import org.apache.commons.classscan.MetaRegistry;
+import org.apache.commons.classscan.test.classes.FullyDecorated;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UriClassLocationTest {
+
+    MetaClassLocation location;
+    MetaClassLoader classLoader;
+    
+    @Before
+    public void loadLocation() throws URISyntaxException {
+        classLoader = MetaRegistry.SINGLETON.getClassLoader(getClass().getClassLoader());
+        String thisUri = getClass().getProtectionDomain().getCodeSource().getLocation().toString();
+        location = classLoader.getClassLocation(thisUri);
+        assertEquals(thisUri, location.getName());        
+    }
+
+    @Test
+    public void testGetMetaClass() throws URISyntaxException {
+        MetaClass thisClass= location.getMetaClass(getClass().getCanonicalName());
+        assertEquals(getClass().getCanonicalName(), thisClass.getName());
+    }
+
+    @Test
+    public void testGetMetaClasses() throws URISyntaxException {
+        Collection<? extends MetaClass> classes= location.getMetaClasses();
+        
+        MetaClass thisClass= location.getMetaClass(getClass().getCanonicalName());
+        assertTrue(classes.contains(thisClass));
+        
+        MetaClass fdClass= location.getMetaClass(FullyDecorated.class.getCanonicalName());
+        assertTrue(classes.contains(fdClass));
+
+        MetaClass objClass = classLoader.findMetaClass(Object.class.getCanonicalName());
+        assertFalse(classes.contains(objClass));
+    }
+}

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/bcel/UriClassLocationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/BadPackage.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/BadPackage.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/BadPackage.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/BadPackage.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,30 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.wrong.test.classes;  // intentionally wrong package to force error
condition
+
+public class BadPackage  {
+    String field;
+    
+    public BadPackage(String field) {
+        this.field = field;
+    }
+
+    public String getField() {
+        return field;
+    }
+
+    public void setField(String field) {
+        this.field = field;
+    }
+}

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/BadPackage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullInterface.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullInterface.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullInterface.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullInterface.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,26 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.classscan.test.classes;
+
+import org.apache.commons.classscan.test.annotations.MethodAnnotation;
+import org.apache.commons.classscan.test.annotations.ParameterAnnotation;
+
+public interface FullInterface {
+
+    @MethodAnnotation
+    int[] getField();
+
+    void setField(@ParameterAnnotation int[] field);
+
+}
\ No newline at end of file

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullyDecorated.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullyDecorated.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullyDecorated.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullyDecorated.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,53 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.classscan.test.classes;
+
+import java.io.Serializable;
+
+import org.apache.commons.classscan.test.annotations.AnnotationAnnotation;
+import org.apache.commons.classscan.test.annotations.ConstructorAnnotation;
+import org.apache.commons.classscan.test.annotations.FieldAnnotation;
+import org.apache.commons.classscan.test.annotations.MethodAnnotation;
+import org.apache.commons.classscan.test.annotations.ParameterAnnotation;
+import org.apache.commons.classscan.test.annotations.TestEnum;
+import org.apache.commons.classscan.test.annotations.TypeAnnotation;
+
+@TypeAnnotation(byteValue = 1, charValue = '&', doubleValue = Math.PI, floatValue = (float)
Math.E, intValue = 42, longValue = 3360, shortValue = 1895, booleanValue = true, stringValue
= "testing", stringArrayValue = {
+        "one", "two" }, enumValue = TestEnum.Three, classValue = Object.class, annotationValue
= @AnnotationAnnotation)
+public class FullyDecorated implements Serializable, FullInterface {
+    private static final long serialVersionUID = 1L;
+
+    @FieldAnnotation
+    private int[] field;
+
+    public static long getSerialVersion() {
+        return serialVersionUID;
+    }
+
+    @ConstructorAnnotation
+    public FullyDecorated(int[] field) {
+        this.field = field;
+    }
+
+    @Override
+    @MethodAnnotation
+    public int[] getField() {
+        return field;
+    }
+
+    @Override
+    public void setField(@ParameterAnnotation int[] field) {
+        this.field = field;
+    }
+}

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/FullyDecorated.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/ValidateFullyDecorated.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/ValidateFullyDecorated.java?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/ValidateFullyDecorated.java
(added)
+++ commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/ValidateFullyDecorated.java
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,331 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.classscan.test.classes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.classscan.MetaAnnotation;
+import org.apache.commons.classscan.MetaClass;
+import org.apache.commons.classscan.MetaField;
+import org.apache.commons.classscan.MetaMethod;
+import org.apache.commons.classscan.MetaParameter;
+import org.apache.commons.classscan.MetaType;
+import org.apache.commons.classscan.MetaAnnotation.Property;
+import org.apache.commons.classscan.test.annotations.AnnotationAnnotation;
+import org.apache.commons.classscan.test.annotations.ConstructorAnnotation;
+import org.apache.commons.classscan.test.annotations.FieldAnnotation;
+import org.apache.commons.classscan.test.annotations.MethodAnnotation;
+import org.apache.commons.classscan.test.annotations.ParameterAnnotation;
+import org.apache.commons.classscan.test.annotations.TestEnum;
+import org.apache.commons.classscan.test.annotations.TypeAnnotation;
+
+public class ValidateFullyDecorated {
+
+    public ValidateFullyDecorated(MetaClass fdClass) {
+        assertClassParent(fdClass.getParent());
+        assertInterfaces(fdClass.getInterfaces());
+        assertClassAnnotations(fdClass.getAnnotations());
+        assertClassAnnotation(fdClass.getAnnotation(TypeAnnotation.class.getCanonicalName()));
+        assertMethods(fdClass.getMethods());
+        assertFields(fdClass.getFields());
+    }
+
+    private void assertClassParent(MetaClass objectClass) {
+        assertEquals(Object.class.getCanonicalName(), objectClass.getName());
+        assertNull(objectClass.getParent());
+    }
+
+    private void assertInterfaces(Set<? extends MetaClass> set) {
+        assertEquals(2, set.size());
+        for (MetaClass iface : set) {      
+            String interfaceName = iface.getName();
+            if(interfaceName.equals(Serializable.class.getCanonicalName())) {
+                continue;
+            }
+            else if(interfaceName.equals(FullInterface.class.getCanonicalName())) {
+                continue;
+            }
+            else {
+                fail("unexpected interface " + interfaceName);
+            }
+        }
+        assertReadOnlySet(set);
+    }
+
+    private void assertClassAnnotations(Set<? extends MetaAnnotation> collection) {
+        assertEquals(1, collection.size());
+        for (MetaAnnotation annotation : collection) {
+            assertEquals(TypeAnnotation.class.getCanonicalName(), annotation.getName());
+            assertClassAnnotation(annotation);
+        }
+        assertReadOnlySet(collection);
+    }
+
+    private void assertClassAnnotation(MetaAnnotation annotation) {
+        Collection<? extends Property> properties = annotation.getProperties();
+        assertEquals(13, properties.size());
+        for (MetaAnnotation.Property property : properties) {
+            String propertyName = property.getName();
+            if (propertyName.equals("byteValue")) {
+                assertEquals(new Byte((byte) 1), property.getValue());
+            }
+            else if (propertyName.equals("charValue")) {
+                assertEquals(new Character('&'), property.getValue());
+            }
+            else if (propertyName.equals("doubleValue")) {
+                assertEquals(new Double(Math.PI), property.getValue());
+            }
+            else if (propertyName.equals("floatValue")) {
+                assertEquals(new Float(Math.E), property.getValue());
+            }
+            else if (propertyName.equals("intValue")) {
+                assertEquals(new Integer(42), property.getValue());
+            }
+            else if (propertyName.equals("longValue")) {
+                assertEquals(new Long(3360), property.getValue());
+            }
+            else if (propertyName.equals("shortValue")) {
+                assertEquals(new Short((short) 1895), property.getValue());
+            }
+            else if (propertyName.equals("booleanValue")) {
+                assertEquals(Boolean.TRUE, property.getValue());
+            }
+            else if (propertyName.equals("stringValue")) {
+                assertEquals("testing", property.getValue());
+            }
+            else if (propertyName.equals("stringArrayValue")) {
+                assertTrue(Arrays.deepEquals(new String[] { "one", "two" }, (Object[]) property.getValue()));
+            }
+            else if (propertyName.equals("annotationValue")) {
+                MetaAnnotation ma = (MetaAnnotation) property.getValue();
+                assertEquals(AnnotationAnnotation.class.getCanonicalName(), ma.getName());
+            }
+            else if (propertyName.equals("enumValue")) {
+                MetaAnnotation.EnumValue ev = (MetaAnnotation.EnumValue) property.getValue();
+                assertEquals(TestEnum.class.getCanonicalName(), ev.getEnumType().getName());
+                assertEquals("Three", ev.getEnumValue());
+            }
+            else if (propertyName.equals("classValue")) {
+                MetaClass mc = (MetaClass) property.getValue();
+                assertEquals(Object.class.getCanonicalName(), mc.getName());
+            }
+            else {
+                fail("unexpected property " + propertyName);
+            }
+        }
+
+        MetaAnnotation.Property byteValue = annotation.getProperty("byteValue");
+        assertEquals(new Byte((byte) 1), byteValue.getValue());
+        assertNull(annotation.getProperty("freddy"));
+    }
+
+    private void assertFields(Set<? extends MetaField> set) {
+        assertEquals(2, set.size());
+        for (MetaField field : set) {
+            if (field.getName().equals("field")) {
+                assertField(field);
+            }
+            else if (field.getName().equals("serialVersionUID")) {
+                assertSerialVersionField(field);
+            }
+            else {
+                fail("unexpected field " + field.getName());
+            }
+        }
+        assertReadOnlySet(set);
+    }
+
+    private void assertField(MetaField field) {
+        assertEquals(false, field.isStatic());
+        assertIntegerArrayType(field.getType());
+        assertAnnotation(FieldAnnotation.class.getCanonicalName(), field.getAnnotations());
+    }
+
+    private void assertLongType(MetaType mt) {
+        assertNull(mt.getArrayMetaType());
+        MetaClass mc = mt.getMetaClass();
+        assertEquals(Long.TYPE.getCanonicalName(), mc.getName());
+    }
+
+    private void assertIntegerArrayType(MetaType mt) {
+        assertNull(mt.getMetaClass());
+        MetaClass mc = mt.getArrayMetaType().getMetaClass();
+        assertEquals(Integer.TYPE.getCanonicalName(), mc.getName());
+    }
+
+    private void assertSerialVersionField(MetaField field) {
+        assertEquals(true, field.isStatic());
+        assertLongType(field.getType());
+        Set<? extends MetaAnnotation> annotations = field.getAnnotations();
+        assertTrue(annotations.isEmpty());
+        assertReadOnlySet(annotations);
+    }
+
+    private void assertMethods(Set<? extends MetaMethod> set) {
+        assertEquals(4, set.size());
+        for (MetaMethod method : set) {
+            String methodName = method.getName();
+            if (methodName.equals("<init>")) {
+                assertConstructor(method);
+            }
+            else if (methodName.equals("getField")) {
+                assertGetFieldMethod(method);
+            }
+            else if (methodName.equals("getSerialVersion")) {
+                assertGetSerialVersionMethod(method);
+            }
+            else if (methodName.equals("setField")) {
+                assertSetFieldMethod(method);
+            }
+            else {
+                fail("unexpected method " + methodName);
+            }
+        }
+        assertReadOnlySet(set);
+    }
+
+    private void assertAnnotation(String annotationName, Set<? extends MetaAnnotation>
set) {
+        assertEquals(1, set.size());
+        for (MetaAnnotation annotation : set) {
+            assertEquals(annotationName, annotation.getName());
+        }
+    }
+
+    private void assertGetFieldMethod(MetaMethod method) {
+        assertEquals(false, method.isStatic());
+        assertIntegerArrayType(method.getType());
+        assertAnnotation(MethodAnnotation.class.getCanonicalName(), method.getAnnotations());
+    }
+
+    private void assertGetSerialVersionMethod(MetaMethod method) {
+        assertEquals(true, method.isStatic());
+        assertLongType(method.getType());
+        assertTrue(method.getAnnotations().isEmpty());
+    }
+
+    private void assertConstructor(MetaMethod method) {
+        assertAnnotation(ConstructorAnnotation.class.getCanonicalName(), method.getAnnotations());
+    }
+
+    private void assertSetFieldMethod(MetaMethod method) {
+        Set<? extends MetaParameter> parameters = method.getParameters();
+        assertEquals(1, parameters.size());
+
+        for (MetaParameter parameter : parameters) {
+            assertAnnotation(ParameterAnnotation.class.getCanonicalName(), parameter.getAnnotations());
+            assertIntegerArrayType(parameter.getType());
+        }
+        assertReadOnlySet(parameters);
+    }
+
+    private <T> void assertReadOnlySet(Set<T> collection) {
+        Object[] cpy = collection.toArray();
+        Object[] allocatedArray = new Object[2];
+        Object[] cpy2 = collection.toArray(allocatedArray);
+        if (collection.size() <= 2) {
+            assertSame(allocatedArray, cpy2);
+            if (collection.size() == 1) {
+                assertNull(cpy2[1]);
+            }
+        }
+        int i = 0;
+        for (T element : collection) {
+            assertEquals(element, cpy[i++]);
+        }
+        if(collection.isEmpty()) {
+            return;
+        }
+
+        assertTrue(collection.containsAll(collection));
+        try {
+            collection.clear();
+            fail("Set not acting read-only");
+        }
+        catch (UnsupportedOperationException expected) {
+        }
+        try {
+            collection.addAll(collection);
+            fail("Set not acting read-only");
+        }
+        catch (UnsupportedOperationException expected) {
+        }
+
+        try {
+            collection.retainAll(collection);
+            fail("Set not acting read-only");
+        }
+        catch (UnsupportedOperationException expected) {
+        }
+
+        try {
+            collection.removeAll(collection);
+            fail("Set not acting read-only");
+        }
+        catch (UnsupportedOperationException expected) {
+        }
+
+        assertFalse(collection.contains(this));
+
+        Iterator<T> iterator = collection.iterator();
+        if (collection.isEmpty()) {
+            assertFalse(iterator.hasNext());
+            try {
+                iterator.next();
+                fail("Iterating past end of elements");
+            }
+            catch (NoSuchElementException expected) {
+            }
+
+            Set<T> singleValueSet = new HashSet<T>(1);
+            singleValueSet.add(null);
+
+            assertFalse(collection.containsAll(singleValueSet));
+        }
+        else {
+            T singleValue = iterator.next();
+            try {
+                iterator.remove();
+                fail("Iterator not acting read-only");
+            }
+            catch (UnsupportedOperationException expected) {
+            }
+            assertTrue(collection.contains(singleValue));
+            try {
+                collection.remove(singleValue);
+                fail("Set not acting read-only");
+            }
+            catch (UnsupportedOperationException expected) {
+            }
+            try {
+                collection.add(singleValue);
+                fail("Set not acting read-only");
+            }
+            catch (UnsupportedOperationException expected) {
+            }
+        }
+    }
+}

Propchange: commons/sandbox/classscan/trunk/src/test/java/org/apache/commons/classscan/test/classes/ValidateFullyDecorated.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/resources/META-INF/org.apache.commons.classscan.test.classes.FullInterface
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/resources/META-INF/org.apache.commons.classscan.test.classes.FullInterface?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/resources/META-INF/org.apache.commons.classscan.test.classes.FullInterface
(added)
+++ commons/sandbox/classscan/trunk/src/test/resources/META-INF/org.apache.commons.classscan.test.classes.FullInterface
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,14 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+org.apache.commons.classcan.test.classes.FullyDecorated

Added: commons/sandbox/classscan/trunk/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/resources/logback.xml?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/resources/logback.xml (added)
+++ commons/sandbox/classscan/trunk/src/test/resources/logback.xml Fri Jun  1 00:27:39 2012
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration debug="false">
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">	
+       <layout class="ch.qos.logback.classic.PatternLayout">
+         <pattern>%msg%n</pattern>
+       </layout>
+    </appender>
+    
+    <root>
+        <level value="INFO" />
+        <appender-ref ref="STDOUT" />
+    </root>
+    
+</configuration>
\ No newline at end of file

Propchange: commons/sandbox/classscan/trunk/src/test/resources/logback.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/--InvalidClassName--.class
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/--InvalidClassName--.class?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/--InvalidClassName--.class
(added)
+++ commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/--InvalidClassName--.class
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,2 @@
+
+This is a file that is not a class.  This file exists to force error condition.
\ No newline at end of file

Added: commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/NotAClass.class
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/NotAClass.class?rev=1344950&view=auto
==============================================================================
--- commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/NotAClass.class
(added)
+++ commons/sandbox/classscan/trunk/src/test/resources/org/apache/commons/classscan/test/classes/NotAClass.class
Fri Jun  1 00:27:39 2012
@@ -0,0 +1,2 @@
+
+This is a file that is not a class.  This file exists to force error condition.
\ No newline at end of file



Mime
View raw message