JSEC-25 renamed some classes to get JUnit to work properly
git-svn-id: https://svn.apache.org/repos/asf/incubator/jsecurity/import/trunk@711869 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/org/jsecurity/AtUnitTest.java b/test/org/jsecurity/AtUnitTestBase.java
similarity index 97%
rename from test/org/jsecurity/AtUnitTest.java
rename to test/org/jsecurity/AtUnitTestBase.java
index cb4466c..539e3dd 100644
--- a/test/org/jsecurity/AtUnitTest.java
+++ b/test/org/jsecurity/AtUnitTestBase.java
@@ -32,5 +32,5 @@
/*@RunWith(AtUnit.class)
@Container(Container.Option.SPRING)
@MockFramework(MockFramework.Option.EASYMOCK)*/
-public class AtUnitTest {
+public class AtUnitTestBase {
}
diff --git a/test/org/jsecurity/config/TestBean.java b/test/org/jsecurity/config/CompositeBean.java
similarity index 84%
rename from test/org/jsecurity/config/TestBean.java
rename to test/org/jsecurity/config/CompositeBean.java
index 97d9114..d5d2651 100644
--- a/test/org/jsecurity/config/TestBean.java
+++ b/test/org/jsecurity/config/CompositeBean.java
@@ -22,13 +22,14 @@
* @author Les Hazlewood
* @since Aug 5, 2008 10:17:37 AM
*/
-public class TestBean {
+public class CompositeBean
+{
private String stringProp;
private boolean booleanProp;
private int intProp;
- private OtherTestBean otherTestBean;
+ private SimpleBean simpleBean;
- public TestBean() {
+ public CompositeBean() {
}
public String getStringProp() {
@@ -55,11 +56,11 @@
this.intProp = intProp;
}
- public OtherTestBean getOtherTestBean() {
- return otherTestBean;
+ public SimpleBean getSimpleBean() {
+ return simpleBean;
}
- public void setOtherTestBean(OtherTestBean otherTestBean) {
- this.otherTestBean = otherTestBean;
+ public void setSimpleBean(SimpleBean simpleBean) {
+ this.simpleBean = simpleBean;
}
}
diff --git a/test/org/jsecurity/config/ReflectionBuilderTest.java b/test/org/jsecurity/config/ReflectionBuilderTest.java
index eaef8d2..b1d8cb0 100644
--- a/test/org/jsecurity/config/ReflectionBuilderTest.java
+++ b/test/org/jsecurity/config/ReflectionBuilderTest.java
@@ -33,62 +33,62 @@
@Test
public void testSimpleConfig() {
Map<String, String> defs = new LinkedHashMap<String, String>();
- defs.put("testBean", "org.jsecurity.config.TestBean");
- defs.put("testBean.stringProp", "blah");
- defs.put("testBean.booleanProp", "true");
- defs.put("testBean.intProp", "42");
+ defs.put("compositeBean", "org.jsecurity.config.CompositeBean");
+ defs.put("compositeBean.stringProp", "blah");
+ defs.put("compositeBean.booleanProp", "true");
+ defs.put("compositeBean.intProp", "42");
ReflectionBuilder builder = new ReflectionBuilder();
Map beans = builder.buildObjects(defs);
- TestBean testBean = (TestBean) beans.get("testBean");
- assertNotNull(testBean);
- assertEquals(testBean.getStringProp(), "blah");
- assertTrue(testBean.isBooleanProp());
- assertEquals(testBean.getIntProp(), 42);
+ CompositeBean compositeBean = (CompositeBean) beans.get("compositeBean");
+ assertNotNull(compositeBean);
+ assertEquals(compositeBean.getStringProp(), "blah");
+ assertTrue(compositeBean.isBooleanProp());
+ assertEquals(compositeBean.getIntProp(), 42);
}
@Test
public void testSimpleConfigWithDollarSignStringValue() {
Map<String, String> defs = new LinkedHashMap<String, String>();
- defs.put("testBean", "org.jsecurity.config.TestBean");
- defs.put("testBean.stringProp", "\\$500");
+ defs.put("compositeBean", "org.jsecurity.config.CompositeBean");
+ defs.put("compositeBean.stringProp", "\\$500");
ReflectionBuilder builder = new ReflectionBuilder();
Map beans = builder.buildObjects(defs);
- TestBean testBean = (TestBean) beans.get("testBean");
- assertEquals(testBean.getStringProp(), "$500");
+ CompositeBean compositeBean = (CompositeBean) beans.get("compositeBean");
+ assertEquals(compositeBean.getStringProp(), "$500");
}
@Test
public void testObjectReferenceConfig() {
Map<String, String> defs = new LinkedHashMap<String, String>();
- defs.put("otherTestBean", "org.jsecurity.config.OtherTestBean");
- defs.put("otherTestBean.intProp", "101");
- defs.put("testBean", "org.jsecurity.config.TestBean");
- defs.put("testBean.stringProp", "blah");
- defs.put("testBean.otherTestBean", "$otherTestBean");
+ defs.put("simpleBean", "org.jsecurity.config.SimpleBean");
+ defs.put("simpleBean.intProp", "101");
+ defs.put("compositeBean", "org.jsecurity.config.CompositeBean");
+ defs.put("compositeBean.stringProp", "blah");
+ defs.put("compositeBean.simpleBean", "$simpleBean");
ReflectionBuilder builder = new ReflectionBuilder();
Map beans = builder.buildObjects(defs);
- TestBean testBean = (TestBean) beans.get("testBean");
- assertNotNull(testBean);
- assertEquals(testBean.getStringProp(), "blah");
- OtherTestBean otherTestBean = (OtherTestBean) beans.get("otherTestBean");
- assertNotNull(otherTestBean);
- assertNotNull(testBean.getOtherTestBean());
- assertEquals(otherTestBean, testBean.getOtherTestBean());
- assertEquals(otherTestBean.getIntProp(), 101);
+ CompositeBean compositeBean = (CompositeBean) beans.get("compositeBean");
+ assertNotNull(compositeBean);
+ assertEquals(compositeBean.getStringProp(), "blah");
+ SimpleBean simpleBean = (SimpleBean) beans.get("simpleBean");
+ assertNotNull(simpleBean);
+ assertNotNull(compositeBean.getSimpleBean());
+ assertEquals(simpleBean, compositeBean.getSimpleBean());
+ assertEquals(simpleBean.getIntProp(), 101);
}
@Test(expected = ConfigurationException.class)
public void testObjectReferenceConfigWithTypeMismatch() {
Map<String, String> defs = new LinkedHashMap<String, String>();
- defs.put("otherTestBean", "org.jsecurity.config.OtherTestBean");
- defs.put("testBean", "org.jsecurity.config.TestBean");
- defs.put("testBean.otherTestBean", "otherTestBean");
+ defs.put("simpleBean", "org.jsecurity.config.SimpleBean");
+ defs.put("compositeBean", "org.jsecurity.config.CompositeBean");
+ defs.put("compositeBean.simpleBean", "simpleBean");
ReflectionBuilder builder = new ReflectionBuilder();
builder.buildObjects(defs);
}
@@ -96,9 +96,9 @@
@Test(expected = UnresolveableReferenceException.class)
public void testObjectReferenceConfigWithInvalidReference() {
Map<String, String> defs = new LinkedHashMap<String, String>();
- defs.put("otherTestBean", "org.jsecurity.config.OtherTestBean");
- defs.put("testBean", "org.jsecurity.config.TestBean");
- defs.put("testBean.otherTestBean", "$foo");
+ defs.put("simpleBean", "org.jsecurity.config.SimpleBean");
+ defs.put("compositeBean", "org.jsecurity.config.CompositeBean");
+ defs.put("compositeBean.simpleBean", "$foo");
ReflectionBuilder builder = new ReflectionBuilder();
builder.buildObjects(defs);
}
diff --git a/test/org/jsecurity/config/OtherTestBean.java b/test/org/jsecurity/config/SimpleBean.java
similarity index 95%
rename from test/org/jsecurity/config/OtherTestBean.java
rename to test/org/jsecurity/config/SimpleBean.java
index 3672b1d..8241346 100644
--- a/test/org/jsecurity/config/OtherTestBean.java
+++ b/test/org/jsecurity/config/SimpleBean.java
@@ -22,12 +22,13 @@
* @author Les Hazlewood
* @since Aug 5, 2008 10:18:01 AM
*/
-public class OtherTestBean {
+public class SimpleBean
+{
private String stringProp = null;
private int intProp;
- public OtherTestBean() {
+ public SimpleBean() {
}
public String getStringProp() {