use of org.drools.core.util.asm.TestBean in project drools by kiegroup.
the class ClassFieldAccessorTest method testBasic.
@Test
public void testBasic() throws Exception {
final Object[] objArray = new Object[1];
final TestBean obj = new TestBean();
obj.setBlah(false);
obj.setSomething("no");
obj.setObjArray(objArray);
final ClassFieldReader ext = store.getReader(TestBean.class, "blah");
assertEquals(false, ((Boolean) ext.getValue(null, obj)).booleanValue());
final ClassFieldReader ext2 = store.getReader(TestBean.class, "fooBar");
assertEquals("fooBar", ext2.getValue(null, obj));
final ClassFieldReader ext3 = store.getReader(TestBean.class, "objArray");
assertEquals(objArray, ext3.getValue(null, obj));
}
use of org.drools.core.util.asm.TestBean in project drools by kiegroup.
the class ClassFieldAccessorTest method testLong.
@Test
public void testLong() throws Exception {
final ClassFieldReader ext = store.getReader(TestBean.class, "longField");
final TestBean bean = new TestBean();
assertEquals(424242, ((Number) ext.getValue(null, bean)).longValue());
}
use of org.drools.core.util.asm.TestBean in project drools by kiegroup.
the class ClassFieldAccessorTest method testNonExistentField.
@Test
public void testNonExistentField() throws Exception {
final Object[] objArray = new Object[1];
final TestBean obj = new TestBean();
obj.setBlah(false);
obj.setSomething("no");
obj.setObjArray(objArray);
ClassFieldReader ext = store.getReader(TestBean.class, "xyz");
assertNull(ext);
}
use of org.drools.core.util.asm.TestBean in project drools by kiegroup.
the class ClassFieldAccessorTest method testBasic.
@Test
public void testBasic() throws Exception {
final Object[] objArray = new Object[1];
final TestBean obj = new TestBean();
obj.setBlah(false);
obj.setSomething("no");
obj.setObjArray(objArray);
final ClassFieldReader ext = store.getReader(TestBean.class, "blah");
assertEquals(false, ((Boolean) ext.getValue(null, obj)).booleanValue());
final ClassFieldReader ext2 = store.getReader(TestBean.class, "fooBar");
assertEquals("fooBar", ext2.getValue(null, obj));
final ClassFieldReader ext3 = store.getReader(TestBean.class, "objArray");
assertEquals(objArray, ext3.getValue(null, obj));
}
use of org.drools.core.util.asm.TestBean in project drools by kiegroup.
the class ClassFieldAccessorTest method testLong.
@Test
public void testLong() throws Exception {
final ClassFieldReader ext = store.getReader(TestBean.class, "longField");
final TestBean bean = new TestBean();
assertEquals(424242, ((Number) ext.getValue(null, bean)).longValue());
}
Aggregations