Java Code Examples for org.azeckoski.reflectutils.ReflectUtils#getInstance()

The following examples show how to use org.azeckoski.reflectutils.ReflectUtils#getInstance() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: sofa-acts   File: CSVApisUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static Map<String, Field> findTargetClsFields(Class<?> cls) {
    if (isWrapClass(cls)) {
        return null;
    }
    ReflectUtils refUtil = ReflectUtils.getInstance();
    ClassFields<?> clsFiled = refUtil.analyzeClass(cls);
    List<Field> getPro = clsFiled.getClassData().getFields();
    Map<String, Field> reClsProp = new HashMap<String, Field>();
    for (Field proValue : getPro) {
        if (Modifier.isFinal(proValue.getModifiers())
            || Modifier.isStatic(proValue.getModifiers())) {
            continue;
        }
        String propName = proValue.getName();
        reClsProp.put(propName, proValue);
    }

    return reClsProp;
}
 
Example 2
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#setFieldStringValue(java.lang.Object, java.lang.String, java.lang.String)}.
 */
public void testSetFieldStringValue() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object thing = null;

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myString", "TEST");
    assertEquals("TEST", ((TestBean)thing).getMyString());

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myInt", "10");
    assertEquals(10, ((TestBean)thing).getMyInt());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "id", "6");
    assertEquals(new Long(6), ((TestEntity)thing).getId());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "sArray", "A, B, C");
    assertEquals(3, ((TestEntity)thing).getSArray().length);
    assertEquals("A", ((TestEntity)thing).getSArray()[0]);
    assertEquals("B", ((TestEntity)thing).getSArray()[1]);
    assertEquals("C", ((TestEntity)thing).getSArray()[2]);
}
 
Example 3
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldType(java.lang.Class, java.lang.String)}.
 */
public void testGetFieldType() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Class<?> type;

    type = reflectUtil.getFieldType(TestBean.class, "myString");
    assertNotNull(type);
    assertEquals(String.class, type);

    type = reflectUtil.getFieldType(TestBean.class, "myInt");
    assertNotNull(type);
    assertEquals(int.class, type);

    type = reflectUtil.getFieldType(TestPea.class, "id");
    assertNotNull(type);
    assertEquals(String.class, type);

    type = reflectUtil.getFieldType(TestNesting.class, "sList");
    assertNotNull(type);
    assertEquals(List.class, type);

    type = reflectUtil.getFieldType(TestNesting.class, "sMap");
    assertNotNull(type);
    assertEquals(Map.class, type);
}
 
Example 4
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#clone(java.lang.Object, int, java.lang.String[])}.
 */
public void testClone() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();

    TestBean tb = new TestBean();
    tb.setMyInt(100);
    tb.setMyString("1000");
    TestBean tbClone = reflectUtil.clone(tb, 0, null);
    assertNotNull(tbClone);
    assertEquals(tb.getMyInt(), tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

    // test skipping values
    tbClone = reflectUtil.clone(tb, 0, new String[] {"myInt"});
    assertNotNull(tbClone);
    assertTrue(tb.getMyInt() != tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

    tbClone = reflectUtil.clone(tb, 5, null);
    assertNotNull(tbClone);
    assertEquals(tb.getMyInt(), tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

}
 
Example 5
public void testPopulateFromParams() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    List<String> results = null;
    Map<String, String[]> properties = new HashMap<String, String[]>();

    TestEntity target = new TestEntity();

    properties.put("id", new String[] {"1000"});
    properties.put("extra", new String[] {"OLD"});
    properties.put("sArray", new String[] {"AA","BB","CC"});
    results = reflectUtil.populateFromParams(target, properties);
    assertNotNull(results);
    assertEquals(3, results.size());
    assertNotNull(target);
    assertEquals(new Long(1000), target.getId());
    assertEquals("OLD", target.getExtra());
    assertEquals("33", target.getEntityId());
    assertEquals(null, target.getBool());
    assertEquals(3, target.getSArray().length);

}
 
Example 6
public void testPopulateFromParams() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    List<String> results = null;
    Map<String, String[]> properties = new HashMap<String, String[]>();

    TestEntity target = new TestEntity();

    properties.put("id", new String[] {"1000"});
    properties.put("extra", new String[] {"OLD"});
    properties.put("sArray", new String[] {"AA","BB","CC"});
    results = reflectUtil.populateFromParams(target, properties);
    assertNotNull(results);
    assertEquals(3, results.size());
    assertNotNull(target);
    assertEquals(new Long(1000), target.getId());
    assertEquals("OLD", target.getExtra());
    assertEquals("33", target.getEntityId());
    assertEquals(null, target.getBool());
    assertEquals(3, target.getSArray().length);

}
 
Example 7
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#setFieldStringValue(java.lang.Object, java.lang.String, java.lang.String)}.
 */
public void testSetFieldStringValue() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object thing = null;

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myString", "TEST");
    assertEquals("TEST", ((TestBean)thing).getMyString());

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myInt", "10");
    assertEquals(10, ((TestBean)thing).getMyInt());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "id", "6");
    assertEquals(new Long(6), ((TestEntity)thing).getId());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "sArray", "A, B, C");
    assertEquals(3, ((TestEntity)thing).getSArray().length);
    assertEquals("A", ((TestEntity)thing).getSArray()[0]);
    assertEquals("B", ((TestEntity)thing).getSArray()[1]);
    assertEquals("C", ((TestEntity)thing).getSArray()[2]);
}
 
Example 8
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#clone(java.lang.Object, int, java.lang.String[])}.
 */
public void testClone() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();

    TestBean tb = new TestBean();
    tb.setMyInt(100);
    tb.setMyString("1000");
    TestBean tbClone = reflectUtil.clone(tb, 0, null);
    assertNotNull(tbClone);
    assertEquals(tb.getMyInt(), tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

    // test skipping values
    tbClone = reflectUtil.clone(tb, 0, new String[] {"myInt"});
    assertNotNull(tbClone);
    assertTrue(tb.getMyInt() != tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

    tbClone = reflectUtil.clone(tb, 5, null);
    assertNotNull(tbClone);
    assertEquals(tb.getMyInt(), tbClone.getMyInt());
    assertEquals(tb.getMyString(), tbClone.getMyString());

}
 
Example 9
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldType(java.lang.Class, java.lang.String)}.
 */
public void testGetFieldType() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Class<?> type;

    type = reflectUtil.getFieldType(TestBean.class, "myString");
    assertNotNull(type);
    assertEquals(String.class, type);

    type = reflectUtil.getFieldType(TestBean.class, "myInt");
    assertNotNull(type);
    assertEquals(int.class, type);

    type = reflectUtil.getFieldType(TestPea.class, "id");
    assertNotNull(type);
    assertEquals(String.class, type);

    type = reflectUtil.getFieldType(TestNesting.class, "sList");
    assertNotNull(type);
    assertEquals(List.class, type);

    type = reflectUtil.getFieldType(TestNesting.class, "sMap");
    assertNotNull(type);
    assertEquals(Map.class, type);
}
 
Example 10
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#setFieldValue(java.lang.Object, java.lang.String, java.lang.Object)}.
 */
public void testSetFieldValue() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object thing = null;

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myString", "TEST");
    assertEquals("TEST", ((TestBean)thing).getMyString());

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myInt", 5);
    assertEquals(5, ((TestBean)thing).getMyInt());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "sArray", new String[] {"A", "B", "C"});
    assertEquals(3, ((TestEntity)thing).getSArray().length);
    assertEquals("A", ((TestEntity)thing).getSArray()[0]);
    assertEquals("B", ((TestEntity)thing).getSArray()[1]);
    assertEquals("C", ((TestEntity)thing).getSArray()[2]);

    thing = new TestBean();
    try {
        reflectUtil.setFieldValue(thing, "id", "uhohes");
        fail("Should have thrown exception");
    } catch (FieldnameNotFoundException e) {
        assertNotNull(e.getMessage());
    }
}
 
Example 11
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldTypes(java.lang.Class)}.
 */
public void testGetFieldTypes() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Map<String, Class<?>> types;

    types = reflectUtil.getFieldTypes(TestBean.class);
    assertNotNull(types);
    assertEquals(2, types.size());
    assertEquals(String.class, types.get("myString"));
    assertEquals(int.class, types.get("myInt"));
}
 
Example 12
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getObjectValues(java.lang.Object)}.
 */
public void testGetObjectValues() {
    Map<String, Object> m = null;
    ReflectUtils reflectUtil = ReflectUtils.getInstance();

    m = reflectUtil.getObjectValues( new TestNone() );
    assertNotNull(m);
    assertEquals(0, m.size());

    m = reflectUtil.getObjectValues( new TestPea() );
    assertNotNull(m);
    assertEquals(2, m.size());
    assertTrue(m.containsKey("id"));
    assertEquals("id", m.get("id"));
    assertTrue(m.containsKey("entityId"));
    assertEquals("EID", m.get("entityId"));

    m = reflectUtil.getObjectValues( new TestBean() );
    assertNotNull(m);
    assertEquals(2, m.size());
    assertTrue(m.containsKey("myInt"));
    assertTrue(m.containsKey("myString"));
    assertEquals(0, m.get("myInt"));
    assertEquals("woot", m.get("myString"));

    m = reflectUtil.getObjectValues( new TestEntity() );
    assertNotNull(m);
    assertEquals(6, m.size());
    assertTrue(m.containsKey("id"));
    assertTrue(m.containsKey("entityId"));
    assertTrue(m.containsKey("extra"));
    assertTrue(m.containsKey("sArray"));
    assertTrue(m.containsKey("bool"));
    assertTrue(m.containsKey("prefix"));
    assertEquals(new Long(3), m.get("id"));
    assertEquals("33", m.get("entityId"));
    assertEquals(null, m.get("extra"));
    assertEquals("crud", m.get("prefix"));
    assertTrue(m.get("sArray").getClass().isArray());
}
 
Example 13
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldNameWithAnnotation(java.lang.Class, java.lang.Class)}.
 */
public void testGetFieldNameWithAnnotation() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    String fieldName = null;

    fieldName = reflectUtil.getFieldNameWithAnnotation(TestBean.class, TestAnnote.class);
    assertEquals("myInt", fieldName);

    fieldName = reflectUtil.getFieldNameWithAnnotation(TestEntity.class, TestAnnote.class);
    assertEquals("entityId", fieldName);
}
 
Example 14
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#copy(java.lang.Object, java.lang.Object, int, java.lang.String[], boolean)}.
 */
public void testCopy() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();

    TestBean orig = new TestBean();
    orig.setMyInt(100);
    orig.setMyString("1000");
    TestBean dest = new TestBean();
    assertNotSame(orig.getMyInt(), dest.getMyInt());
    assertNotSame(orig.getMyString(), dest.getMyString());
    reflectUtil.copy(orig, dest, 0, null, false);
    assertNotNull(dest);
    assertEquals(orig.getMyInt(), dest.getMyInt());
    assertEquals(orig.getMyString(), dest.getMyString());

    dest = new TestBean();
    reflectUtil.copy(orig, dest, 0, new String[] {"myInt"}, false);
    assertNotNull(dest);
    assertNotSame(orig.getMyInt(), dest.getMyInt());
    assertEquals(orig.getMyString(), dest.getMyString());

    dest = new TestBean();
    reflectUtil.copy(orig, dest, 5, null, true);
    assertNotNull(dest);
    assertEquals(orig.getMyInt(), dest.getMyInt());
    assertEquals(orig.getMyString(), dest.getMyString());
}
 
Example 15
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#setFieldValue(java.lang.Object, java.lang.String, java.lang.Object)}.
 */
public void testSetFieldValue() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object thing = null;

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myString", "TEST");
    assertEquals("TEST", ((TestBean)thing).getMyString());

    thing = new TestBean();
    reflectUtil.setFieldValue(thing, "myInt", 5);
    assertEquals(5, ((TestBean)thing).getMyInt());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "sArray", new String[] {"A", "B", "C"});
    assertEquals(3, ((TestEntity)thing).getSArray().length);
    assertEquals("A", ((TestEntity)thing).getSArray()[0]);
    assertEquals("B", ((TestEntity)thing).getSArray()[1]);
    assertEquals("C", ((TestEntity)thing).getSArray()[2]);

    thing = new TestBean();
    try {
        reflectUtil.setFieldValue(thing, "id", "uhohes");
        fail("Should have thrown exception");
    } catch (FieldnameNotFoundException e) {
        assertNotNull(e.getMessage());
    }
}
 
Example 16
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldTypes(java.lang.Class)}.
 */
public void testGetFieldTypes() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Map<String, Class<?>> types;

    types = reflectUtil.getFieldTypes(TestBean.class);
    assertNotNull(types);
    assertEquals(2, types.size());
    assertEquals(String.class, types.get("myString"));
    assertEquals(int.class, types.get("myInt"));
}
 
Example 17
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getObjectValues(java.lang.Object)}.
 */
public void testGetObjectValues() {
    Map<String, Object> m = null;
    ReflectUtils reflectUtil = ReflectUtils.getInstance();

    m = reflectUtil.getObjectValues( new TestNone() );
    assertNotNull(m);
    assertEquals(0, m.size());

    m = reflectUtil.getObjectValues( new TestPea() );
    assertNotNull(m);
    assertEquals(2, m.size());
    assertTrue(m.containsKey("id"));
    assertEquals("id", m.get("id"));
    assertTrue(m.containsKey("entityId"));
    assertEquals("EID", m.get("entityId"));

    m = reflectUtil.getObjectValues( new TestBean() );
    assertNotNull(m);
    assertEquals(2, m.size());
    assertTrue(m.containsKey("myInt"));
    assertTrue(m.containsKey("myString"));
    assertEquals(0, m.get("myInt"));
    assertEquals("woot", m.get("myString"));

    m = reflectUtil.getObjectValues( new TestEntity() );
    assertNotNull(m);
    assertEquals(6, m.size());
    assertTrue(m.containsKey("id"));
    assertTrue(m.containsKey("entityId"));
    assertTrue(m.containsKey("extra"));
    assertTrue(m.containsKey("sArray"));
    assertTrue(m.containsKey("bool"));
    assertTrue(m.containsKey("prefix"));
    assertEquals(new Long(3), m.get("id"));
    assertEquals("33", m.get("entityId"));
    assertEquals(null, m.get("extra"));
    assertEquals("crud", m.get("prefix"));
    assertTrue(m.get("sArray").getClass().isArray());
}
 
Example 18
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldValue(java.lang.Object, java.lang.String)}.
 */
@SuppressWarnings("unchecked")
public void testGetFieldValueObjectString() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object value = null;
    Object thing = null;

    thing = new TestEntity();
    value = reflectUtil.getFieldValue( thing, "entityId");
    assertNotNull(value);
    assertEquals("33", value);

    value = reflectUtil.getFieldValue( thing, "id");
    assertNotNull(value);
    assertEquals(new Long(3), value);

    TestNesting nested = new TestNesting(10, "100", new String[] {"A", "B"});
    value = reflectUtil.getFieldValue( nested, "id");
    assertNotNull(value);
    assertEquals(10, value);

    value = reflectUtil.getFieldValue( nested, "testEntity.id");
    assertNotNull(value);
    assertEquals(new Long(3), value);

    // get list value
    value = reflectUtil.getFieldValue( nested, "sList[0]");
    assertNotNull(value);
    assertEquals("A", value);

    value = reflectUtil.getFieldValue( nested, "sList[1]");
    assertNotNull(value);
    assertEquals("B", value);

    value = reflectUtil.getFieldValue( nested, "sList");
    assertNotNull(value);
    assertEquals("A", ((List)value).get(0));

    // get map value
    value = reflectUtil.getFieldValue( nested, "sMap(A1)");
    assertNotNull(value);
    assertEquals("ONE", value);

    value = reflectUtil.getFieldValue( nested, "sMap(B2)");
    assertNotNull(value);
    assertEquals("TWO", value);

    value = reflectUtil.getFieldValue( thing, "extra");
    assertNull(value);

    value = reflectUtil.getFieldValue( thing, "sArray");
    assertNotNull(value);
    assertTrue(value.getClass().isArray());
    assertEquals("1", ((String[])value)[0]);
    assertEquals("2", ((String[])value)[1]);

    // basic pea support
    thing = new TestPea();
    value = reflectUtil.getFieldValue( thing, "id");
    assertNotNull(value);
    assertEquals("id", value);

    thing = new TestBean();
    try {
        value = reflectUtil.getFieldValue(thing, "id");
        fail("Should have thrown exception");
    } catch (FieldnameNotFoundException e) {
        assertNotNull(e.getMessage());
    }
}
 
Example 19
public void testSetFieldValueWithConversion() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object thing = null;

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "id", "10");
    assertEquals(new Long(10), ((TestEntity)thing).getId());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "id", 10);
    assertEquals(new Long(10), ((TestEntity)thing).getId());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "id", new String[] {"10"});
    assertEquals(new Long(10), ((TestEntity)thing).getId());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "bool", true);
    assertEquals(Boolean.TRUE, ((TestEntity)thing).getBool());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "bool", "true");
    assertEquals(Boolean.TRUE, ((TestEntity)thing).getBool());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "bool", "false");
    assertEquals(Boolean.FALSE, ((TestEntity)thing).getBool());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "bool", "");
    assertEquals(Boolean.FALSE, ((TestEntity)thing).getBool());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "extra", "stuff");
    assertEquals("stuff", ((TestEntity)thing).getExtra());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "extra", 100);
    assertEquals("100", ((TestEntity)thing).getExtra());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "extra", new String[] {"stuff"});
    assertEquals("stuff", ((TestEntity)thing).getExtra());

    thing = new TestEntity();
    reflectUtil.setFieldValue(thing, "extra", new String[] {"stuff", "plus"});
    assertEquals("stuff,plus", ((TestEntity)thing).getExtra());
}
 
Example 20
/**
 * Test method for {@link org.sakaiproject.entitybroker.util.reflect.ReflectUtil#getFieldValue(java.lang.Object, java.lang.String)}.
 */
@SuppressWarnings("unchecked")
public void testGetFieldValueObjectString() {
    ReflectUtils reflectUtil = ReflectUtils.getInstance();
    Object value = null;
    Object thing = null;

    thing = new TestEntity();
    value = reflectUtil.getFieldValue( thing, "entityId");
    assertNotNull(value);
    assertEquals("33", value);

    value = reflectUtil.getFieldValue( thing, "id");
    assertNotNull(value);
    assertEquals(new Long(3), value);

    TestNesting nested = new TestNesting(10, "100", new String[] {"A", "B"});
    value = reflectUtil.getFieldValue( nested, "id");
    assertNotNull(value);
    assertEquals(10, value);

    value = reflectUtil.getFieldValue( nested, "testEntity.id");
    assertNotNull(value);
    assertEquals(new Long(3), value);

    // get list value
    value = reflectUtil.getFieldValue( nested, "sList[0]");
    assertNotNull(value);
    assertEquals("A", value);

    value = reflectUtil.getFieldValue( nested, "sList[1]");
    assertNotNull(value);
    assertEquals("B", value);

    value = reflectUtil.getFieldValue( nested, "sList");
    assertNotNull(value);
    assertEquals("A", ((List)value).get(0));

    // get map value
    value = reflectUtil.getFieldValue( nested, "sMap(A1)");
    assertNotNull(value);
    assertEquals("ONE", value);

    value = reflectUtil.getFieldValue( nested, "sMap(B2)");
    assertNotNull(value);
    assertEquals("TWO", value);

    value = reflectUtil.getFieldValue( thing, "extra");
    assertNull(value);

    value = reflectUtil.getFieldValue( thing, "sArray");
    assertNotNull(value);
    assertTrue(value.getClass().isArray());
    assertEquals("1", ((String[])value)[0]);
    assertEquals("2", ((String[])value)[1]);

    // basic pea support
    thing = new TestPea();
    value = reflectUtil.getFieldValue( thing, "id");
    assertNotNull(value);
    assertEquals("id", value);

    thing = new TestBean();
    try {
        value = reflectUtil.getFieldValue(thing, "id");
        fail("Should have thrown exception");
    } catch (FieldnameNotFoundException e) {
        assertNotNull(e.getMessage());
    }
}