@Test
public void testPrimitive() throws IOException, JSONException, IllegalAccessException, InstantiationException,
  NoSuchFieldException, NoSuchMethodException, InvocationTargetException
{

  String addressClassName = TupleSchemaRegistry.FQCN_PACKAGE + "Energy_v1";
  TupleSchemaRegistry.Schema schema = new TupleSchemaRegistry.Schema();
  schema.addField("streetNumber", Integer.class);
  schema.addField("houseNumber", Long.class);
  schema.addField("condo", Boolean.class);
  schema.addField("water-usage", Float.class);
  schema.addField("electricity-usage", Double.class);
  schema.addField("startDate", Date.class);
  byte[] beanClass = BeanClassGenerator.createAndWriteBeanClass(addressClassName, schema.fieldList);
  Class<?> clazz = ClassLoaderUtils.readBeanClass(addressClassName, beanClass);
  Object o = clazz.newInstance();
  Field f = clazz.getDeclaredField("streetNumber");
  Assert.assertNotNull(f);
  //int setter and getter
  Method m = clazz.getDeclaredMethod("setStreetNumber", Integer.class);
  m.invoke(o, 343);
  m = clazz.getMethod("getStreetNumber");
  Integer result = (Integer)m.invoke(o);
  assertEquals("reflect getStreetNumber invoke", 343, result.intValue());
  //long setter and getter
  m = clazz.getDeclaredMethod("setHouseNumber", Long.class);
  m.invoke(o, 123L);
  m = clazz.getMethod("getHouseNumber");
  Long houseNum = (Long)m.invoke(o);
  assertEquals("reflect getHouseNumber invoke", 123L, houseNum.longValue());
  //boolean setter and getter
  m = clazz.getDeclaredMethod("setCondo", Boolean.class);
  m.invoke(o, true);
  m = clazz.getMethod("getCondo");
  Boolean isCondo = (Boolean)m.invoke(o);
  assertEquals("reflect getCondo invoke", true, isCondo);
  //float setter and getter
  m = clazz.getDeclaredMethod("setWater-usage", Float.class);
  m.invoke(o, 88.34F);
  m = clazz.getMethod("getWater-usage");
  Float waterUsage = (Float)m.invoke(o);
  assertEquals("reflect getWaterUsage invoke", 88.34F, waterUsage.floatValue(), 0);
  //double setter and getter
  m = clazz.getDeclaredMethod("setElectricity-usage", Double.class);
  m.invoke(o, 88.343243);
  m = clazz.getMethod("getElectricity-usage");
  Double electricityUsage = (Double)m.invoke(o);
  assertEquals("reflect getWaterUsage invoke", 88.343243, electricityUsage, 0);
  Date now = new Date();
  m = clazz.getDeclaredMethod("setStartDate", Date.class);
  m.invoke(o, now);
  m = clazz.getMethod("getStartDate");
  Date startDate = (Date)m.invoke(o);
  assertEquals("reflect getStartDate invoke", now, startDate);
  m = clazz.getMethod("getStartDateMs");
  long startDateMs = (long)m.invoke(o);
  assertEquals("reflect getStartDateMs invoke", now.getTime(), startDateMs, 0);
  m = clazz.getMethod("getStartDateSec");
  int startDateSec = (int)m.invoke(o);
  assertEquals("reflect getStartDateSec invoke", now.getTime() / 1000, startDateSec, 0);
  m = clazz.getDeclaredMethod("setStartDateMs", Long.class);
  m.invoke(o, now.getTime());
  m = clazz.getMethod("getStartDate");
  startDate = (Date)m.invoke(o);
  assertEquals("reflect getStartDate invoke", now, startDate);
  m = clazz.getMethod("getStartDateMs");
  startDateMs = (long)m.invoke(o);
  assertEquals("reflect getStartDateMs invoke", now.getTime(), startDateMs, 0);
  m = clazz.getMethod("getStartDateSec");
  startDateSec = (int)m.invoke(o);
  assertEquals("reflect getStartDateSec invoke", now.getTime() / 1000, startDateSec, 0);
  m = clazz.getDeclaredMethod("setStartDateSec", Integer.class);
  m.invoke(o, (int)(now.getTime() / 1000));
  now = new Date(now.getTime() / 1000 * 1000);
  m = clazz.getMethod("getStartDate");
  startDate = (Date)m.invoke(o);
  assertEquals("reflect getStartDate invoke", now, startDate);
  m = clazz.getMethod("getStartDateMs");
  startDateMs = (long)m.invoke(o);
  assertEquals("reflect getStartDateMs invoke", now.getTime(), startDateMs, 0);
  m = clazz.getMethod("getStartDateSec");
  startDateSec = (int)m.invoke(o);
  assertEquals("reflect getStartDateSec invoke", now.getTime() / 1000, startDateSec, 0);
}