### Question:
PhysicalWebCollection { public UrlDevice getUrlDeviceById(String id) { return mDeviceIdToUrlDeviceMap.get(id); } PhysicalWebCollection(); boolean addUrlDevice(UrlDevice urlDevice); void removeUrlDevice(UrlDevice urlDevice); void addMetadata(PwsResult pwsResult); void addIcon(String url, byte[] icon); void clear(); byte[] getIcon(String url); UrlDevice getUrlDeviceById(String id); PwsResult getMetadataByBroadcastUrl(String broadcastUrl); List<UrlDevice> getUrlDevices(); JSONObject jsonSerialize(); static PhysicalWebCollection jsonDeserialize(JSONObject jsonObject); List<PwPair> getPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getGroupedPwPairsSortedByRank(Comparator<PwPair> comparator); List<PwPair> getPwPairs(); PwPair getTopRankedPwPairByGroupId(String groupId, Comparator<PwPair> comparator); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion); void setPwsEndpoint(String pwsEndpoint, int pwsApiVersion, String pwsApiKey); void fetchPwsResults(final PwsResultCallback pwsResultCallback,
                              final PwsResultIconCallback pwsResultIconCallback); void cancelAllRequests();  }### Answer:
@Test public void getUrlDeviceByIdReturnsFoundUrlDevice() { UrlDevice urlDevice = physicalWebCollection1.getUrlDeviceById(ID1); assertEquals(urlDevice.getId(), ID1); assertEquals(urlDevice.getUrl(), URL1); }
@Test public void getUrlDeviceByIdReturnsNullForMissingUrlDevice() { UrlDevice fetchedUrlDevice = physicalWebCollection1.getUrlDeviceById(ID2); assertNull(fetchedUrlDevice); }