@Test public void get_url_no_real_file() throws Exception { String path = "/foo/ContextResourceTest.class"; URL url = getClass().getResource("ContextResourceTest.class"); Context context = mockContext(); expect(context.getRealFile(path)).andReturn(null); expect(context.getResource("/foo/ContextResourceTest.class")).andReturn(url); replay(); Resource r = new ContextResource(context, "foo/ContextResourceTest.class"); assertSame(r.toURL(), url); verify(); }
public URL toURL() { try { acquireReadLock(); if (!urlResolved) { resolveURL(); } return url; } finally { releaseReadLock(); } }
ContextResource extends AbstractResource { public URL toURL() { try { acquireReadLock(); if (!urlResolved) { resolveURL(); } return url; } finally { releaseReadLock(); } } }
ContextResource extends AbstractResource { public URL toURL() { try { acquireReadLock(); if (!urlResolved) { resolveURL(); } return url; } finally { releaseReadLock(); } } ContextResource(Context context, String path); }
ContextResource extends AbstractResource { public URL toURL() { try { acquireReadLock(); if (!urlResolved) { resolveURL(); } return url; } finally { releaseReadLock(); } } ContextResource(Context context, String path); @Override String toString(); URL toURL(); @Override int hashCode(); @Override boolean equals(Object obj); }
ContextResource extends AbstractResource { public URL toURL() { try { acquireReadLock(); if (!urlResolved) { resolveURL(); } return url; } finally { releaseReadLock(); } } ContextResource(Context context, String path); @Override String toString(); URL toURL(); @Override int hashCode(); @Override boolean equals(Object obj);  }