@Test
public void testIsTarget() {

    Map<String, Object> requestScope = new HashMap<String, Object>();
    requestScope.put("one", 1);
    expect(request.getContext("request")).andReturn(requestScope).times(
            EXPECTED_REQUEST_CALLS);
    Map<String, Object> applicationScope = new HashMap<String, Object>();
    applicationScope.put("two", 2);
    Map<String, Object> sessionScope = new HashMap<String, Object>();
    sessionScope.put("three", "three");
    expect(request.getContext("session")).andReturn(sessionScope).times(
            EXPECTED_SESSION_CALLS);
    expect(request.getAvailableScopes()).andReturn(
            Arrays.asList(new String[] { "request", "session", "application" }))
            .anyTimes();
    expect(request.getContext("application")).andReturn(applicationScope).anyTimes();
    replay(request, applicationContext);
    assertTrue(factory.isTarget("one"));
    assertTrue(factory.isTarget("two"));
    assertTrue(factory.isTarget("three"));
    assertFalse(factory.isTarget("four"));
    verify(request, applicationContext);
}