@Test public void updateAlienDevice() 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 result = handler.doUpdateDevice(device); System.out.println("Result: " + result + " | Device: " + device); device.setUser(user2); device.setLastIp("1.1.1.1"); device.setAppVersion("3.3.3"); result = handler.doUpdateDevice(device); System.out.println("Result: " + result + " | Device: " + device); assertEquals("-1", result); }
@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; }