[webbeans-commits] Webbeans SVN: r3212 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sat Jul 25 08:47:33 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-07-25 08:47:33 -0400 (Sat, 25 Jul 2009)
New Revision: 3212
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java
Log:
Add a @Current test
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java 2009-07-25 12:46:49 UTC (rev 3211)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java 2009-07-25 12:47:33 UTC (rev 3212)
@@ -4,6 +4,7 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Current;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.BeanManagerImpl;
@@ -15,10 +16,12 @@
{
private static boolean RECEIVE_1_OBSERVED;
private static boolean RECEIVE_2_OBSERVED;
+ private static boolean RECEIVE_3_OBSERVED;
private static void initFlags() {
RECEIVE_1_OBSERVED = false;
RECEIVE_2_OBSERVED = false;
+ RECEIVE_3_OBSERVED = false;
}
@Test
@@ -32,6 +35,7 @@
assert RECEIVE_2_OBSERVED == true;
assert RECEIVE_1_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == false;
initFlags();
@@ -39,6 +43,7 @@
assert RECEIVE_2_OBSERVED == true;
assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_3_OBSERVED == true;
}
@Test
@@ -54,6 +59,7 @@
assert RECEIVE_1_OBSERVED == true;
assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == false;
initFlags();
@@ -61,6 +67,7 @@
assert RECEIVE_2_OBSERVED == true;
assert RECEIVE_1_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == false;
initFlags();
@@ -68,6 +75,15 @@
assert RECEIVE_2_OBSERVED == true;
assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_3_OBSERVED == false;
+
+ initFlags();
+
+ app.fireEventViaCurrent();
+
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_3_OBSERVED == true;
}
public static class App
@@ -80,6 +96,9 @@
@Any
Event<String> event3;
+
+ @Current
+ Event<String> event4;
public void fireEventByAnnotationLiteral()
{
@@ -95,6 +114,11 @@
{
event3.fire("Fired using Event Interface with Non-BindingType.");
}
+
+ public void fireEventViaCurrent()
+ {
+ event4.fire("Fired using Event Interface with @Current");
+ }
}
public static class Receiver
@@ -108,5 +132,10 @@
{
RECEIVE_2_OBSERVED = true;
}
+
+ public void receive3(@Observes String s)
+ {
+ RECEIVE_3_OBSERVED = true;
+ }
}
}
\ No newline at end of file
More information about the weld-commits
mailing list