01: package junitx.ddtunit.util;
02:
03: import junit.framework.TestCase;
04: import junitx.ddtunit.resources.SimpleVO;
05:
06: public class PrivilegedAccessorTest extends TestCase {
07: private SimpleVO simpleVO;
08:
09: @Override
10: protected void setUp() throws Exception {
11: simpleVO = new SimpleVO();
12: }
13:
14: public void testSetFieldValue() throws IllegalAccessException,
15: NoSuchFieldException {
16: String stringValue = "Hallo World";
17: PrivilegedAccessor.setFieldValue(simpleVO, "stringValue",
18: stringValue);
19: assertEquals("Wrong stringValue", stringValue, simpleVO
20: .getStringValue());
21: try {
22: PrivilegedAccessor.setFieldValue(simpleVO, "stringValue",
23: null);
24: } catch (RuntimeException ex) {
25: fail("No Expected exception: " + ex.getMessage());
26: }
27: }
28:
29: }
|