### Question:
IrisBeans { public static <T> BeanGetter<T> getter(Class<T> clazz) { return new BeanGetter<T>(clazz); }  static BeanGetter<T> getter(Class<T> clazz);  }### Answer:
@Test public void testDevice() { Device device = new Device(); device.setAccount(ACCOUNT_ID); device.setProtocol(PROTOCOL); device.setProtocolid(PROTOCOL_ID); device.setDrivername(DRIVER_NAME); device.setDriverversion(DRIVER_VERSION); device.setAddress(DRIVER_ADDRESS); device.setProtocolAddress(PROTOCOL_ADDRESS); device.setHubId(HUB_ID); device.setPlace(PLACE_ID); device.setCaps(CAPS); device.setDevtypehint(DEVTYPE_HINT); device.setName(NAME); device.setVendor(VENDOR); device.setModel(MODEL); device.setProductId(PRODUCT_ID); device.setState(STATE); BeanGetter<Device> deviceGetter = IrisBeans.getter(Device.class); Assert.assertEquals(ACCOUNT_ID, deviceGetter.get("account", device)); Assert.assertEquals(PROTOCOL, deviceGetter.get("protocol", device)); Assert.assertEquals(PROTOCOL_ID, deviceGetter.get("protocolId", device)); Assert.assertEquals(DRIVER_NAME, deviceGetter.get("DriverName", device)); Assert.assertEquals(DRIVER_VERSION, deviceGetter.get("DRIVERVERSION", device)); Assert.assertEquals(DRIVER_ADDRESS, deviceGetter.get("address", device)); Assert.assertEquals(PROTOCOL_ADDRESS, deviceGetter.get("ProtocolAddress", device)); Assert.assertEquals(HUB_ID, deviceGetter.get("hubid", device)); Assert.assertEquals(PLACE_ID, deviceGetter.get("placeid", device)); Assert.assertEquals(CAPS, deviceGetter.get("caps", device)); Assert.assertEquals(DEVTYPE_HINT, deviceGetter.get("devtypeHint", device)); Assert.assertEquals(NAME, deviceGetter.get("name", device)); Assert.assertEquals(VENDOR, deviceGetter.get("vendor", device)); Assert.assertEquals(MODEL, deviceGetter.get("model", device)); Assert.assertEquals(PRODUCT_ID, deviceGetter.get("productid", device)); Assert.assertEquals(STATE, deviceGetter.get("state", device)); Assert.assertNull(deviceGetter.get("subprotocol", device)); }
@Test public void testDeviceWithCoerce() { Device device = new Device(); device.setAccount(ACCOUNT_ID); device.setProtocol(PROTOCOL); device.setProtocolid(PROTOCOL_ID); device.setDrivername(DRIVER_NAME); device.setDriverversion(DRIVER_VERSION); device.setAddress(DRIVER_ADDRESS); device.setProtocolAddress(PROTOCOL_ADDRESS); device.setHubId(HUB_ID); device.setPlace(PLACE_ID); device.setCaps(CAPS); device.setDevtypehint(DEVTYPE_HINT); device.setName(NAME); device.setVendor(VENDOR); device.setModel(MODEL); device.setProductId(PRODUCT_ID); device.setState(STATE); BeanGetter<Device> deviceGetter = IrisBeans.getter(Device.class); Assert.assertEquals(ACCOUNT_ID.toString(), deviceGetter.getAs(String.class, "account", device)); }