@Test(expected = NullPointerException.class) public void testSetCurrentContainerWithContainerException() { Request request = createMock(Request.class); ApplicationContext context = createMock(ApplicationContext.class); Map<String, Object> attribs = new HashMap<String, Object>(); expect(context.getApplicationScope()).andReturn(attribs).anyTimes(); replay(request, context); try { TilesAccess.setCurrentContainer(request, (TilesContainer) null); } finally { verify(request, context); } }
public static void setCurrentContainer(Request request, String key) { ApplicationContext applicationContext = request.getApplicationContext(); TilesContainer container = getContainer(applicationContext, key); if (container != null) { request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } }
TilesAccess { public static void setCurrentContainer(Request request, String key) { ApplicationContext applicationContext = request.getApplicationContext(); TilesContainer container = getContainer(applicationContext, key); if (container != null) { request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } } }
TilesAccess { public static void setCurrentContainer(Request request, String key) { ApplicationContext applicationContext = request.getApplicationContext(); TilesContainer container = getContainer(applicationContext, key); if (container != null) { request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } } private  TilesAccess(); }
TilesAccess { public static void setCurrentContainer(Request request, String key) { ApplicationContext applicationContext = request.getApplicationContext(); TilesContainer container = getContainer(applicationContext, key); if (container != null) { request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } } private  TilesAccess(); static void setContainer(ApplicationContext context,
            TilesContainer container); static void setContainer(ApplicationContext context,
            TilesContainer container, String key); static TilesContainer getContainer(ApplicationContext context); static TilesContainer getContainer(ApplicationContext context,
            String key); static void setCurrentContainer(Request request,
            String key); static void setCurrentContainer(Request request,
            TilesContainer container); static TilesContainer getCurrentContainer(Request request); }
TilesAccess { public static void setCurrentContainer(Request request, String key) { ApplicationContext applicationContext = request.getApplicationContext(); TilesContainer container = getContainer(applicationContext, key); if (container != null) { request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } } private  TilesAccess(); static void setContainer(ApplicationContext context,
            TilesContainer container); static void setContainer(ApplicationContext context,
            TilesContainer container, String key); static TilesContainer getContainer(ApplicationContext context); static TilesContainer getContainer(ApplicationContext context,
            String key); static void setCurrentContainer(Request request,
            String key); static void setCurrentContainer(Request request,
            TilesContainer container); static TilesContainer getCurrentContainer(Request request); static final String CURRENT_CONTAINER_ATTRIBUTE_NAME; static final String CONTAINER_ATTRIBUTE; }