@SuppressWarnings("unchecked") @Test(expectedExceptions=HttpRuntimeException.class) public void testGetReservedDevicesWithEmptyToken() throws HttpException { RestClient mockClient = EasyMock.createMock(RestClient.class); DawgPoundClient client = new DawgPoundClient(); client.setClient(mockClient); Map[] maps = new HashMap[1]; maps[0] = new HashMap<>(); EasyMock.expect(mockClient.get((String) EasyMock.anyObject(),(Class<Map[]>)EasyMock.anyObject())).andThrow(new HttpRuntimeException() ); EasyMock.replay(mockClient); String token=""; client.getReservedDevices(token); }
@Override public Collection<MetaStb> getReservedDevices(String token) { List<MetaStb> devices = new ArrayList<>(); try { @SuppressWarnings("unchecked") Map<String, Object>[] maps = client.get("/reserved/token/"+token, Map[].class); for (Map<String,Object> map : maps) { devices.add(new MetaStb(map)); } } catch (HttpException e) { e.printStackTrace(); throw new HttpRuntimeException(e); } return devices; }
DawgPoundClient extends DawgClient implements IDawgPoundClient, DeviceProvider { @Override public Collection<MetaStb> getReservedDevices(String token) { List<MetaStb> devices = new ArrayList<>(); try { @SuppressWarnings("unchecked") Map<String, Object>[] maps = client.get("/reserved/token/"+token, Map[].class); for (Map<String,Object> map : maps) { devices.add(new MetaStb(map)); } } catch (HttpException e) { e.printStackTrace(); throw new HttpRuntimeException(e); } return devices; } }
DawgPoundClient extends DawgClient implements IDawgPoundClient, DeviceProvider { @Override public Collection<MetaStb> getReservedDevices(String token) { List<MetaStb> devices = new ArrayList<>(); try { @SuppressWarnings("unchecked") Map<String, Object>[] maps = client.get("/reserved/token/"+token, Map[].class); for (Map<String,Object> map : maps) { devices.add(new MetaStb(map)); } } catch (HttpException e) { e.printStackTrace(); throw new HttpRuntimeException(e); } return devices; } DawgPoundClient();  DawgPoundClient(String baseURL); }
DawgPoundClient extends DawgClient implements IDawgPoundClient, DeviceProvider { @Override public Collection<MetaStb> getReservedDevices(String token) { List<MetaStb> devices = new ArrayList<>(); try { @SuppressWarnings("unchecked") Map<String, Object>[] maps = client.get("/reserved/token/"+token, Map[].class); for (Map<String,Object> map : maps) { devices.add(new MetaStb(map)); } } catch (HttpException e) { e.printStackTrace(); throw new HttpRuntimeException(e); } return devices; } DawgPoundClient();  DawgPoundClient(String baseURL); @Override Collection<MetaStb> getReservedDevices(String token); @Override void reserve(Reservation reservation); @SuppressWarnings("unchecked") @Override Reservation getReservation(String deviceId); @Override Collection<MetaStb> getDevices(String token); }
DawgPoundClient extends DawgClient implements IDawgPoundClient, DeviceProvider { @Override public Collection<MetaStb> getReservedDevices(String token) { List<MetaStb> devices = new ArrayList<>(); try { @SuppressWarnings("unchecked") Map<String, Object>[] maps = client.get("/reserved/token/"+token, Map[].class); for (Map<String,Object> map : maps) { devices.add(new MetaStb(map)); } } catch (HttpException e) { e.printStackTrace(); throw new HttpRuntimeException(e); } return devices; } DawgPoundClient();  DawgPoundClient(String baseURL); @Override Collection<MetaStb> getReservedDevices(String token); @Override void reserve(Reservation reservation); @SuppressWarnings("unchecked") @Override Reservation getReservation(String deviceId); @Override Collection<MetaStb> getDevices(String token); static final String DEFAULT_BASE_URL; }