### Question:
ServiceHostFunctionProcessor extends ServiceRegistryFunctionProcessorBase<ServiceHostFunctionDescriptor> implements UrlRewriteFunctionProcessor<ServiceHostFunctionDescriptor> { @Override public List<String> resolve( UrlRewriteContext context, List<String> parameters ) throws Exception { List<String> results = null; if( parameters != null ) { results = new ArrayList<>( parameters.size() ); for( String parameter : parameters ) { String url = lookupServiceUrl( parameter ); if( url != null ) { Template template = Parser.parseLiteral( url ); Host host = template.getHost(); if( host != null ) { parameter = host.getFirstValue().getPattern(); } } results.add( parameter ); } } return results; }  @Override String name(); @Override List<String> resolve( UrlRewriteContext context, List<String> parameters );  }### Answer:
@Test public void testResolve() throws Exception { ServiceHostFunctionProcessor func = new ServiceHostFunctionProcessor(); func.initialize( env, desc ); assertThat( func.resolve( ctx, Collections.singletonList("test-service")), contains( "test-host" ) ); assertThat( func.resolve( ctx, Collections.singletonList("invalid-test-service")), contains( "invalid-test-service" ) ); assertThat( func.resolve( ctx, null ), nullValue() ); func.destroy(); }