ResourceCache { @SuppressWarnings("unchecked") public <T> T get(String url, Class<T> clazz) { Serializable cacheKey = key(url, clazz); if (cache.isKeyInCache(cacheKey)) { Element element = cache.get(cacheKey); if (element != null) { Object objectValue = element.getObjectValue(); return (T) objectValue; } } return null; } ResourceCache(); @SuppressWarnings("unchecked") T get(String url, Class<T> clazz); @SuppressWarnings("unchecked") T get(String url, Class<T> clazz, MediaType mediaType); void put(T object, String url, Class<T> clazz); void put(T object, String url, Class<T> clazz, MediaType mediaType);  }
@Test public void should_not_get_element() { ResourceCache cache = new ResourceCache(); assertNull(cache.get("url", ResourceCache.class)); }
@Test public void should_not_get_element_wth_media_type() { ResourceCache cache = new ResourceCache(); assertNull(cache.get("url", ResourceCache.class, MediaType.TEXT_HTML_TYPE)); }