@Test
  public void updateExistingDevice() throws Exception {

    Device device = new Device();
    device.setUser(user1);
    device.setName("john's computer");
    device.setOs("Linux");
    device.setLastIp("15.26.156.98");
    device.setAppVersion("1.2.3");

    UUID result1 = handler.doUpdateDevice(device);

    System.out.println("Result: " + result1 + " | Device: " + device);

    assertNotEquals("-1", result1);

    device.setLastIp("1.1.1.1");
    device.setAppVersion("3.3.3");

    UUID result2 = handler.doUpdateDevice(device);
    System.out.println("Result: " + result2 + " | Device: " + device);

    assertEquals(result1, result2);
  }
  @Override
  public UUID updateDevice(UpdateDeviceRequest request)
      throws UserNotFoundException, DeviceNotValidException, DeviceNotUpdatedException {

    logger.debug(request.toString());

    User user = new User();
    user.setId(request.getUserId());

    Device device = new Device();
    device.setId(request.getDeviceId());
    device.setUser(user);
    device.setName(request.getDeviceName());
    device.setOs(request.getOs());
    device.setLastIp(request.getIp());
    device.setAppVersion(request.getAppVersion());

    UUID deviceId = getHandler().doUpdateDevice(device);

    return deviceId;
  }