Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistAnnotationFactoryTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistAnnotationFactoryTest.java?rev=967275&view=auto
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistAnnotationFactoryTest.java
(added)
+++
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistAnnotationFactoryTest.java
Fri Jul 23 21:44:40 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.proxy2.stub;
+
+import org.apache.commons.proxy2.ProxyFactory;
+import org.apache.commons.proxy2.javassist.JavassistProxyFactory;
+import org.apache.commons.proxy2.stub.AnnotationFactory;
+
+/**
+ * Test {...@link AnnotationFactory} with {...@link JavassistProxyFactory}.
+ */
+public class JavassistAnnotationFactoryTest extends
+ AbstractAnnotationFactoryTest {
+
+ /**
+ * {...@inheritdoc}
+ */
+ @Override
+ protected ProxyFactory createProxyFactory() {
+ return new JavassistProxyFactory();
+ }
+}
Propchange:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistAnnotationFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistStubProxyFactoryTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistStubProxyFactoryTest.java?rev=967275&view=auto
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistStubProxyFactoryTest.java
(added)
+++
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistStubProxyFactoryTest.java
Fri Jul 23 21:44:40 2010
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.proxy2.stub;
+
+import org.apache.commons.proxy2.ProxyFactory;
+import org.apache.commons.proxy2.javassist.JavassistProxyFactory;
+
+/**
+ * Test {...@link StubProxyFactory} with {...@link JavassistProxyFactory}.
+ */
+public class JavassistStubProxyFactoryTest extends
AbstractStubProxyFactoryTest {
+ /**
+ * {...@inheritdoc}
+ */
+ @Override
+ protected ProxyFactory createParent() {
+ return new JavassistProxyFactory();
+ }
+}
Propchange:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JavassistStubProxyFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkAnnotationFactoryTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkAnnotationFactoryTest.java?rev=967275&view=auto
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkAnnotationFactoryTest.java
(added)
+++
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkAnnotationFactoryTest.java
Fri Jul 23 21:44:40 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.proxy2.stub;
+
+import org.apache.commons.proxy2.ProxyFactory;
+import org.apache.commons.proxy2.jdk.JdkProxyFactory;
+import org.apache.commons.proxy2.stub.AnnotationFactory;
+
+/**
+ * Test {...@link AnnotationFactory} with {...@link JdkProxyFactory}.
+ */
+public class JdkAnnotationFactoryTest extends
+ AbstractAnnotationFactoryTest {
+
+ /**
+ * {...@inheritdoc}
+ */
+ @Override
+ protected ProxyFactory createProxyFactory() {
+ return new JdkProxyFactory();
+ }
+}
Propchange:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkAnnotationFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkStubProxyFactoryTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkStubProxyFactoryTest.java?rev=967275&view=auto
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkStubProxyFactoryTest.java
(added)
+++
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkStubProxyFactoryTest.java
Fri Jul 23 21:44:40 2010
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.proxy2.stub;
+
+import org.apache.commons.proxy2.ProxyFactory;
+import org.apache.commons.proxy2.jdk.JdkProxyFactory;
+
+/**
+ * Test {...@link StubProxyFactory} with {...@link JdkProxyFactory}.
+ */
+public class JdkStubProxyFactoryTest extends AbstractStubProxyFactoryTest {
+ /**
+ * {...@inheritdoc}
+ */
+ @Override
+ protected ProxyFactory createParent() {
+ return new JdkProxyFactory();
+ }
+}
Propchange:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/JdkStubProxyFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubConfigurerTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubConfigurerTest.java?rev=967275&view=auto
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubConfigurerTest.java
(added)
+++
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubConfigurerTest.java
Fri Jul 23 21:44:40 2010
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.proxy2.stub;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.proxy2.stub.StubConfigurer;
+import org.junit.Test;
+
+/**
+ * Test StubConfigurer stubType calculation.
+ */
+public class StubConfigurerTest {
+ public interface Foo {
+ }
+
+ public class FooConfigurer extends StubConfigurer<Foo> {
+ /**
+ * {...@inheritdoc}
+ */
+ @Override
+ protected void configure(Foo stub) {
+ }
+ }
+
+ public class GenericConfigurer<T> extends StubConfigurer<T> {
+ public GenericConfigurer() {
+ }
+
+ public GenericConfigurer(Class<T> stubType) {
+ super(stubType);
+ }
+
+ protected void configure(T stub) {
+ }
+ }
+
+ public class GenericFooConfigurer extends GenericConfigurer<Foo> {
+ }
+
+ @Test
+ public void testAnonymousInner() {
+ assertEquals(Foo.class, new StubConfigurer<Foo>() {
+
+ @Override
+ protected void configure(Foo stub) {
+ }
+ }.getStubType());
+ }
+
+ @Test
+ public void testStubTypeCalculation() {
+ assertEquals(Foo.class, new FooConfigurer().getStubType());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testGenericFailure() {
+ new GenericConfigurer<Foo>();
+ }
+
+ @Test
+ public void testGenericWithStubType() {
+ assertEquals(Foo.class, new
GenericConfigurer<Foo>(Foo.class).getStubType());
+ }
+
+ @Test
+ public void testDownHierarchy() {
+ assertEquals(Foo.class, new GenericFooConfigurer().getStubType());
+ }
+
+ @Test
+ public void testGenericSubclass() {
+ assertEquals(Foo.class, new GenericConfigurer<Foo>() {}.getStubType());
+ }
+}
Propchange:
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubConfigurerTest.java
------------------------------------------------------------------------------
svn:eol-style = native