openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsandt...@apache.org
Subject svn commit: r1629881 - /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java
Date Tue, 07 Oct 2014 12:57:35 GMT
Author: rsandtner
Date: Tue Oct  7 12:57:35 2014
New Revision: 1629881

URL: http://svn.apache.org/r1629881
Log:
OWB-992 added test with repeatable generic types

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java?rev=1629881&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/RepeatedGenericTypeDecoratorTest.java
Tue Oct  7 12:57:35 2014
@@ -0,0 +1,87 @@
+/*
+ * 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.webbeans.test.decorators.tests;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Test;
+
+public class RepeatedGenericTypeDecoratorTest extends AbstractUnitTest
+{
+
+    @Test
+    public void testRepeatedGenericDecorator() throws Exception
+    {
+        addDecorator(MyServiceDecorator.class);
+        startContainer(MyInterface.class, MyService.class, MyServiceDecorator.class);
+
+        MyService myService = getInstance(MyService.class);
+
+        myService.doSomethingStrange(new MyInterface<MyInterface>()
+        {
+            @Override
+            public void doSomethingStrange(MyInterface param)
+            {
+                // have no idea here too
+            }
+        });
+
+        shutDownContainer();
+    }
+
+
+    public static interface MyInterface<T>
+    {
+        void doSomethingStrange(T param);
+    }
+
+
+    public static class MyService implements MyInterface<MyInterface<MyInterface>>
{
+
+        @Override
+        public void doSomethingStrange(MyInterface<MyInterface> param)
+        {
+            // don't know what to do here
+            // i have no idea for a usecase
+            param.doSomethingStrange(param);
+        }
+    }
+
+
+    @Decorator
+    public static class MyServiceDecorator implements MyInterface<MyInterface<MyInterface>>
+    {
+
+        @Delegate
+        @Inject
+        @Any
+        private MyInterface<MyInterface<MyInterface>> delegate;
+
+        @Override
+        public void doSomethingStrange(MyInterface<MyInterface> param)
+        {
+            // really have no idea what to do here
+            param.doSomethingStrange(param);
+        }
+    }
+}



Mime
View raw message