Author: pete.muir(a)jboss.org
Date: 2010-07-23 13:44:58 -0400 (Fri, 23 Jul 2010)
New Revision: 6768
Removed:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Grault.java
Log:
Tidy up tests
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -33,11 +33,12 @@
@Inject
private Garply injectedGarply;
+ // A Garply with no @Inject
private Garply garply;
- public String getValue()
+ public Garply getInjectedGarply()
{
- return injectedGarply.value();
+ return injectedGarply;
}
public Garply getGarply()
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -30,32 +30,20 @@
@Generic(Garply.class)
public class Baz
{
- @Inject
- public Baz(Foo args)
- {
- constArgs = args;
- }
@Inject
- private Bar dep;
+ private Bar bar;
@Inject
- private Corge normalBean;
+ private Corge corge;
- private Foo constArgs;
-
- public String getValue()
+ public Bar getBar()
{
- return dep.getValue();
+ return bar;
}
-
- public Garply getNoData()
- {
- return dep.getGarply();
- }
- public Corge getNormalBean()
+ public Corge getCorge()
{
- return normalBean;
+ return corge;
}
}
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -24,5 +24,10 @@
*/
public class Corge
{
+
+ public String getName()
+ {
+ return "fred";
+ }
}
Deleted:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.extensions.test.bean.generic;
-
-import javax.inject.Inject;
-
-import org.jboss.weld.extensions.bean.generic.Generic;
-
-/**
- * A generic bean
- *
- * @author pmuir
- *
- */
-
-(a)Generic(Garply.class)
-public class Foo
-{
- @Inject
- private Garply data;
-
- public String getValue()
- {
- return data.value();
- }
-
-}
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -28,7 +28,7 @@
import org.jboss.weld.extensions.bean.generic.GenericAnnotation;
/**
- * A "generic annotation"
+ * The annotation used to configure a generic bean
*
* @author pmuir
*
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -46,10 +46,19 @@
@Test
public void testGeneric()
{
- assert baz1.getValue().equals("hello1");
- assert baz2.getValue().equals("hello2");
- assert baz1.getNoData() == null;
- assert baz2.getNoData() == null;
- assert baz2.getNormalBean() != null;
+ // Test that the generic injection wiring is working!
+ assert baz1.getBar() != null;
+ assert baz1.getBar().getInjectedGarply() != null;
+ assert baz1.getBar().getInjectedGarply().value().equals("hello2");
+ assert baz1.getBar().getInjectedGarply().value().equals("hello1");
+ assert baz2.getBar() != null;
+ assert baz2.getBar().getInjectedGarply() != null;
+ assert baz2.getBar().getInjectedGarply().value().equals("hello2");
+ // Check that this isn't affecting annotations on the generic bean without
@Inject
+ assert baz1.getBar().getGarply() == null;
+ assert baz2.getBar().getGarply() == null;
+ // Check that normal bean injection is working correctly!
+ assert baz2.getCorge() != null;
+ assert baz2.getCorge().getName() == "fred";
}
}
Modified:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Grault.java
===================================================================
---
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Grault.java 2010-07-23
17:15:26 UTC (rev 6767)
+++
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Grault.java 2010-07-23
17:44:58 UTC (rev 6768)
@@ -28,7 +28,7 @@
import javax.inject.Qualifier;
/**
- * A "normal" qualifier
+ * A qualifier
*
* @author pmuir
*