### Question:
RedirectCommand extends AbstractCommand { public Command targetedCommand( final Object target ) { if ( !( target instanceof String ) ) { throw new IllegalArgumentException( "Target must non-null and of type String." ); } return new RedirectCommand( getRequestContext(), ( String )target, getContentTemplate(), ( String )target ); } private  RedirectCommand( final ContextEnum currentContext, final String target ); private  RedirectCommand( final String requestContext, final String urlPattern, final String contentTemplate, final String target ); Command targetedCommand( final Object target ); String getName(); Permission requiredPermission(); static final Command REDIRECT; }### Answer:
@Test public void testTargetedCommand() { final Command a = RedirectCommand.REDIRECT; Command b = a.targetedCommand( "%uTestPage.jsp" ); Assertions.assertEquals( "", b.getRequestContext() ); Assertions.assertEquals( "TestPage.jsp", b.getJSP() ); Assertions.assertEquals( "%uTestPage.jsp", b.getURLPattern() ); Assertions.assertNull( b.getContentTemplate() ); Assertions.assertEquals( "%uTestPage.jsp", b.getTarget() ); Assertions.assertNotSame( RedirectCommand.REDIRECT, b ); b = a.targetedCommand( "http: Assertions.assertEquals( "", b.getRequestContext() ); Assertions.assertEquals( "http: Assertions.assertEquals( "http: Assertions.assertNull( b.getContentTemplate() ); Assertions.assertEquals( "http: Assertions.assertNotSame( RedirectCommand.REDIRECT, b ); }