UrlRewriteEnvironment decEnvironment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
EasyMock.expect( decEnvironment.getAttribute( GatewayServices.GATEWAY_SERVICES_ATTRIBUTE ) ).andReturn( gatewayServices ).anyTimes();
EasyMock.expect( decEnvironment.getAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE ) ).andReturn( "test-cluster-name" ).anyTimes();
Params decParams = EasyMock.createNiceMock( Params.class );
EasyMock.expect( decParams.resolve( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE ) ).andReturn( Arrays.asList("test-cluster-name") ).anyTimes();
UrlRewriteContext decContext = EasyMock.createNiceMock( UrlRewriteContext.class );
EasyMock.expect( decContext.getCurrentUrl() ).andReturn( encTemplate.getValue() );
EasyMock.expect( decContext.getParameters() ).andReturn( decParams );
Capture<Template> decTemplate = new Capture<Template>();
decContext.setCurrentUrl( EasyMock.capture( decTemplate ) );