Author: marius.bogoevici
Date: 2009-12-15 00:07:47 -0500 (Tue, 15 Dec 2009)
New Revision: 5287
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BaseClass.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/Subclass.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/TestBean.java
Log:
Adding more tests for WELD-339
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BaseClass.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BaseClass.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BaseClass.java 2009-12-15
05:07:47 UTC (rev 5287)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.jboss.weld.tests.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class BaseClass
+{
+}
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java 2009-12-15
05:07:47 UTC (rev 5287)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.jboss.weld.tests.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class BoundedGenericBean<T extends BaseClass>
+{
+ public T echo (T param) {
+ return param;
+ }
+}
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java 2009-12-15
05:05:36 UTC (rev 5286)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java 2009-12-15
05:07:47 UTC (rev 5287)
@@ -18,7 +18,6 @@
package org.jboss.weld.tests.generic;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
@@ -35,5 +34,11 @@
TestBean testBean = getCurrentManager().getInstanceByType(TestBean.class);
assert "Hello".equals(testBean.echo("Hello"));
assert Integer.valueOf(1).equals(testBean.echo(1));
+ Subclass subclassInstance = new Subclass();
+ assert subclassInstance == testBean.echo(subclassInstance);
+ assert subclassInstance == testBean.echo((BaseClass)subclassInstance);
+ BaseClass baseInstance = new BaseClass();
+ assert baseInstance == testBean.echo(baseInstance);
}
+
}
\ No newline at end of file
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/Subclass.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/Subclass.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/Subclass.java 2009-12-15
05:07:47 UTC (rev 5287)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.jboss.weld.tests.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class Subclass extends BaseClass
+{
+
+}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/TestBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/TestBean.java 2009-12-15
05:05:36 UTC (rev 5286)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/TestBean.java 2009-12-15
05:07:47 UTC (rev 5287)
@@ -28,6 +28,11 @@
@Inject GenericInterface<Integer> genericIntegerField;
+ @Inject BoundedGenericBean<Subclass> boundedGenericSubclassField;
+
+ @Inject BoundedGenericBean<BaseClass> boundedGenericBaseField;
+
+
public String echo(String param)
{
return genericStringField.echo(param);
@@ -37,5 +42,15 @@
{
return genericIntegerField.echo(param);
}
+
+ public Subclass echo (Subclass param)
+ {
+ return boundedGenericSubclassField.echo(param);
+ }
+
+ public BaseClass echo (BaseClass param)
+ {
+ return boundedGenericBaseField.echo(param);
+ }
}