### Question:
LostRequestHandler implements DriverServiceRequestHandler { @Override public MessageBody handleMessage(PlatformMessage message) throws Exception { logger.info("received a lost device request: {}", message); Device device = loadDevice(message); deviceService.lostDevice(Address.fromString(device.getAddress())); return LostDeviceResponse.instance(); } @Inject  LostRequestHandler(
         DeviceDAO deviceDao,
         PlatformMessageBus platformBus,
         DeviceService deviceService); @Override MessageBody handleMessage(PlatformMessage message); @Override String getMessageType();  }### Answer:
@Test public void handleRequest() throws Exception { device = createDevice(); EasyMock.expect(devDao.findById(device.getId())).andReturn(device); service.lostDevice(Address.fromString(device.getAddress())); EasyMock.expectLastCall(); replay(); MessageBody body = DeviceConnectionCapability.LostDeviceRequest.instance(); PlatformMessage message = PlatformMessage.buildRequest(body,DeviceDriverAddress.fromString(device.getAddress()),DeviceDriverAddress.fromString(device.getAddress())).create(); handler.handleMessage(message); verify(); }
@Test public void handleRequestAddressNotFound() throws Exception { device = createDevice(); EasyMock.expect(devDao.findById(device.getId())).andReturn(null); replay(); MessageBody body = DeviceConnectionCapability.LostDeviceRequest.instance(); PlatformMessage message = PlatformMessage.buildRequest(body,DeviceDriverAddress.fromString(device.getAddress()),DeviceDriverAddress.fromString(device.getAddress())).create(); try{ handler.handleMessage(message); fail(); } catch(NotFoundException e){ } verify(); }