use of com.opensymphony.xwork2.TestBean in project commons-beanutils by apache.
the class Jira358TestCase method testPropertyUtils_getIndexedProperty_List.
/**
* Test {@link PropertyUtils#getIndexedProperty(Object, String, int)}
*/
public void testPropertyUtils_getIndexedProperty_List() throws Exception {
final TestBean bean = new TestBean();
try {
PropertyUtils.getIndexedProperty(bean, "listIndexed", bean.getListIndexed().size());
fail("Expected IndexOutOfBoundsException");
} catch (final IndexOutOfBoundsException e) {
// expected result
}
}
use of com.opensymphony.xwork2.TestBean in project commons-beanutils by apache.
the class LocaleBeanUtilsTestCase method testSetNestedPropertySimple.
/**
* Test setting a nested simple property
*/
public void testSetNestedPropertySimple() {
final TestBean bean = new TestBean();
bean.getNested().setIntProperty(5);
assertEquals("Initial value 5", 5, bean.getNested().getIntProperty());
try {
LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", null);
} catch (final Throwable t) {
log.error(t);
fail("Threw " + t);
}
assertEquals("Check Set Value", 123, bean.getNested().getIntProperty());
}
use of com.opensymphony.xwork2.TestBean in project commons-beanutils by apache.
the class LocaleBeanUtilsTestCase method testSetNestedPropertyIndexed.
/**
* Test setting a nested indexed property
*/
public void testSetNestedPropertyIndexed() {
final TestBean bean = new TestBean();
bean.getNested().setIntIndexed(1, 51);
assertEquals("Initial value[1] 51", 51, bean.getNested().getIntIndexed(1));
try {
LocaleBeanUtils.setProperty(bean, "nested.intIndexed[1]", "123", null);
} catch (final Throwable t) {
log.error(t);
fail("Threw " + t);
}
assertEquals("Check Set Value", 123, bean.getNested().getIntIndexed(1));
}
use of com.opensymphony.xwork2.TestBean in project commons-beanutils by apache.
the class Jira358TestCase method testPropertyUtils_getIndexedProperty_Array.
/**
* Test {@link PropertyUtils#getIndexedProperty(Object, String, int)}
*/
public void testPropertyUtils_getIndexedProperty_Array() throws Exception {
final TestBean bean = new TestBean();
try {
PropertyUtils.getIndexedProperty(bean, "intArray", bean.getIntArray().length);
fail("Expected ArrayIndexOutOfBoundsException");
} catch (final ArrayIndexOutOfBoundsException e) {
// expected result
}
}
use of com.opensymphony.xwork2.TestBean in project struts by apache.
the class SpringObjectFactoryTest method testShouldAutowireObjectsObtainedFromTheObjectFactoryByFullClassName.
public void testShouldAutowireObjectsObtainedFromTheObjectFactoryByFullClassName() throws Exception {
sac.getBeanFactory().registerSingleton("bean", new TestBean());
TestBean bean = (TestBean) sac.getBean("bean");
SimpleAction action = (SimpleAction) objectFactory.buildBean(SimpleAction.class.getName(), null);
assertEquals(bean, action.getBean());
}
Aggregations