26272829303132333435363738
@Test public void get_url() throws Exception { URL url = getClass().getResource("ContextResourceTest.class"); Context context = mockContext(); expect(context.getResource("/foo/Bar.txt")).andReturn(url); replay(); Resource r = new ContextResource(context, "foo/Bar.txt");
4243444546474849505152
} @Test public void to_string() { Context context = mockContext(); replay(); Resource r = new ContextResource(context, "foo/Bar.txt");
565758596061626364656667
} @Test public void hash_code() { Context context1 = mockContext(); Context context2 = mockContext(); replay(); Resource r1 = new ContextResource(context1, "foo"); Resource r2 = new ContextResource(context1, "foo");
767778798081828384858687
} @Test public void equals() { Context context1 = mockContext(); Context context2 = mockContext(); Resource r = mockResource(); replay(); Resource r1 = new ContextResource(context1, "foo");
116117118119120121122123124125126
expect(servletContext.getAttribute(name)).andReturn(value); replay(); Context context = new ContextImpl(servletContext); assertSame(context.getAttribute(name), value); verify(); }
2526272829303132333435
public class ContextAssetFactoryTest extends InternalBaseTestCase { @Test public void root_resource() { Context context = mockContext(); Request request = mockRequest(); replay(); AssetFactory factory = new ContextAssetFactory(request, context);
4041424344454647484950
} @Test public void asset_client_URL() { Context context = mockContext(); Request request = mockRequest(); Resource r = new ContextResource(context, "foo/Bar.txt"); train_getContextPath(request, "/context");
2324252627282930313233
{ @Test public void missing_spring_context() { Context context = newContext(null); replay(); try {
4748495051525354555657
@Test public void success() { WebApplicationContext webContext = newMock(WebApplicationContext.class); Context context = newContext(webContext); replay(); assertSame(SpringModule.build(context), webContext);
585960616263646566676869
verify(); } protected final Context newContext(Object webApplicationContext) { Context context = newContext(); expect(context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)) .andReturn(webApplicationContext); return context; }