### Question:
InboundUrlFunctionProcessor implements UrlRewriteFunctionProcessor<InboundUrlFunctionDescriptor> { @Override public List<String> resolve( UrlRewriteContext context, List<String> parameters ) throws Exception { if( parameters == null || parameters.isEmpty()) { return Collections.emptyList(); } else { switch( context.getDirection() ) { case IN: return Collections.emptyList(); case OUT: return context.getParameters().resolve( UrlRewriteResponse.INBOUND_QUERY_PARAM_PREFIX + parameters.get( 0 )); default: return Collections.emptyList(); } } }  @Override String name(); @Override void initialize( UrlRewriteEnvironment environment, InboundUrlFunctionDescriptor descriptor ); @Override void destroy(); @Override List<String> resolve( UrlRewriteContext context, List<String> parameters );  }### Answer:
@Test public void testServiceResolve() throws Exception { ServiceLoader loader = ServiceLoader.load( UrlRewriteFunctionProcessor.class ); Iterator iterator = loader.iterator(); assertThat( "Service iterator empty.", iterator.hasNext() ); InboundUrlFunctionProcessor proc = null; while( iterator.hasNext() ) { Object object = iterator.next(); if( object instanceof InboundUrlFunctionProcessor ) { proc = (InboundUrlFunctionProcessor) object ; } } if( proc == null ) { fail("Failed to find " + InboundUrlFunctionProcessor.class.getName() + " via service loader."); } Map<String,UrlRewriteFunctionProcessor> functions = new HashMap<>(); UrlRewriteEnvironment environment = EasyMock.createNiceMock( UrlRewriteEnvironment.class ); UrlRewriter.Direction direction = UrlRewriter.Direction.OUT; List<String> parameters = Collections.singletonList("host"); Template template = Parser.parseLiteral( "https: UrlRewriteContextImpl ctx = new UrlRewriteContextImpl( environment, this.getRewriteResponse(), functions, direction, template ); List<String> result = proc.resolve(ctx, parameters); assertThat( result.get(0), is( "http: }