UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class );
EasyMock.expect( environment.getAttribute( GatewayServices.GATEWAY_SERVICES_ATTRIBUTE ) ).andReturn( gatewayServices ).anyTimes();
EasyMock.expect( environment.resolve( "cluster.name" ) ).andReturn( Arrays.asList( "test-cluster-name" ) ).anyTimes();
EasyMock.expect( environment.getResource( "/WEB-INF/hostmap.txt" ) ).andReturn( configUrl ).anyTimes();
Resolver resolver = EasyMock.createNiceMock( Resolver.class );
EasyMock.expect( resolver.resolve( "host" ) ).andReturn( Arrays.asList( "test-inbound-host" ) ).anyTimes();
EasyMock.replay( gatewayServices, hm, hms, environment, resolver );
UrlRewriteRulesDescriptor descriptor = UrlRewriteRulesDescriptorFactory.create();
UrlRewriteRuleDescriptor rule = descriptor.addRule( "test-rule" );
rule.pattern( "{*}://{host}:{*}/{**}?{**}" );