commit 554cf3f350c07fa696c95b2c510036d870276bf5
Author:     jangalinski <jan.galin...@holisticon.de>
AuthorDate: Wed, 3 Jul 2013 20:02:21 +0200
Commit:     Mauro Talevi <mauro.tal...@aquilonia.org>
CommitDate: Tue, 16 Jul 2013 08:56:09 +0100

    JBEHAVE-899: POC needle constructor injection works

diff --git 
a/examples/needle/src/test/java/org/jbehave/examples/core/needle/steps/NeedleTraderStepsTest.java
 
b/examples/needle/src/test/java/org/jbehave/examples/core/needle/steps/NeedleTraderStepsTest.java
new file mode 100644
index 0000000..5b9622a
--- /dev/null
+++ 
b/examples/needle/src/test/java/org/jbehave/examples/core/needle/steps/NeedleTraderStepsTest.java
@@ -0,0 +1,39 @@
+package org.jbehave.examples.core.needle.steps;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+import javax.inject.Inject;
+
+import org.jbehave.examples.core.service.TradingService;
+import org.junit.Rule;
+import org.junit.Test;
+
+import de.akquinet.jbosscc.needle.annotation.ObjectUnderTest;
+import de.akquinet.jbosscc.needle.junit.NeedleRule;
+
+/**
+ * Test Constructor injection for steps.
+ * @author Jan Galinski, Holisticon AG
+ */
+public class NeedleTraderStepsTest {
+
+    // PONR - Plain old needle rule
+    @Rule
+    public final NeedleRule needle = new NeedleRule();
+
+    // should be created via constructor injection.
+    @ObjectUnderTest
+    private NeedleTraderSteps needleTraderSteps;
+
+    @Inject
+    private TradingService tradingServiceMock;
+
+    @Test
+    public void 
shouldCreateNewInstanceViaConstructorInjectionWithMockedService() {
+        assertNotNull(needleTraderSteps);
+        assertThat(needleTraderSteps.getService(), is(tradingServiceMock));
+    }
+
+}



Reply via email to