Revision: 410
http://svn.sourceforge.net/stripes/?rev=410&view=rev
Author: tfenne
Date: 2006-09-06 04:43:16 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Comitting patch of additional test from James Strachan (and fixed some
deprecated TestNG constructs).
Modified Paths:
--------------
trunk/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java
Modified:
trunk/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java
===================================================================
---
trunk/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java
2006-09-03 19:30:44 UTC (rev 409)
+++
trunk/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java
2006-09-06 11:43:16 UTC (rev 410)
@@ -1,13 +1,12 @@
package net.sourceforge.stripes.integration.spring;
+import net.sourceforge.stripes.exception.StripesRuntimeException;
+import net.sourceforge.stripes.test.TestActionBean;
import net.sourceforge.stripes.test.TestBean;
-import net.sourceforge.stripes.test.TestActionBean;
-import net.sourceforge.stripes.exception.StripesRuntimeException;
import org.springframework.context.support.StaticApplicationContext;
-import org.testng.annotations.Configuration;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.ExpectedExceptions;
-import org.testng.Assert;
/**
* Unit tests for the SpringHelper class that injects spring managed beans
@@ -18,7 +17,7 @@
public class SpringHelperTests {
StaticApplicationContext ctx;
- @Configuration(beforeTestClass=true, alwaysRun=true)
+ @BeforeClass(alwaysRun=true)
protected void setupSpringContext() {
ctx = new StaticApplicationContext();
ctx.registerSingleton("test/TestBean", TestBean.class);
@@ -134,6 +133,18 @@
///////////////////////////////////////////////////////////////////////////
+ private static class DerivedFromImplicitFieldTarget extends
ImplicitFieldTarget {
+ }
+
+ @Test(groups="fast")
+ public void testDerivedFromImplicitFieldInjection() {
+ DerivedFromImplicitFieldTarget target = new
DerivedFromImplicitFieldTarget();
+ SpringHelper.injectBeans(target, ctx);
+ Assert.assertNotNull(target.getBean());
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+
private static class ByTypeTarget {
@SpringBean private TestBean someBeanOrOther;
TestBean getBean() { return someBeanOrOther; }
@@ -177,7 +188,7 @@
@SpringBean TestActionBean someBeanOrOther;
}
- @Test(groups="fast") @ExpectedExceptions(StripesRuntimeException.class)
+ @Test(groups="fast", expectedExceptions=StripesRuntimeException.class)
public void testAmbiguousByTypeInjection() {
AmbiguousByTypeTarget target = new AmbiguousByTypeTarget();
SpringHelper.injectBeans(target, ctx);
@@ -189,7 +200,7 @@
@SpringBean("nonExistentBean") TestActionBean someBeanOrOther;
}
- @Test(groups="fast") @ExpectedExceptions(StripesRuntimeException.class)
+ @Test(groups="fast", expectedExceptions=StripesRuntimeException.class)
public void testExplicitMisNamedTargetInjection() {
ExplicitMisNamedTarget target = new ExplicitMisNamedTarget();
SpringHelper.injectBeans(target, ctx);
@@ -201,7 +212,7 @@
@SpringBean TestActionBean tstActionBea;
}
- @Test(groups="fast") @ExpectedExceptions(StripesRuntimeException.class)
+ @Test(groups="fast", expectedExceptions=StripesRuntimeException.class)
public void testImplicitMisNamedTargetInjection() {
ImplicitMisNamedTarget target = new ImplicitMisNamedTarget();
SpringHelper.injectBeans(target, ctx);
@@ -213,7 +224,7 @@
@SpringBean SpringHelperTests noBeansOfType;
}
- @Test(groups="fast") @ExpectedExceptions(StripesRuntimeException.class)
+ @Test(groups="fast", expectedExceptions=StripesRuntimeException.class)
public void testNoBeansOfTargetTypeInjection() {
NoBeanOfTypeTarget target = new NoBeanOfTypeTarget();
SpringHelper.injectBeans(target, ctx);
@@ -229,7 +240,7 @@
}
}
- @Test(groups="fast") @ExpectedExceptions(StripesRuntimeException.class)
+ @Test(groups="fast", expectedExceptions=StripesRuntimeException.class)
public void testInvalidSetterSignatureInjection() {
InvalidSetterSignatureTarget target = new
InvalidSetterSignatureTarget();
SpringHelper.injectBeans(target, ctx);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development