@Test public void testSupportAndResolve() throws NoSuchMethodException { MethodParameter methodParameter = new MethodParameter( this.getClass().getMethod("testSupportAndResolve"), 0, ServiceClientFactory.class, MethodParameter.EMPTY_ANNOTATIONS ); RequestEnvelope envelope = Utils.buildSimpleEnvelope("intent"); ServiceClientFactory factory = ServiceClientFactory.builder().build(); HandlerInput handlerInput = HandlerInput.builder().withRequestEnvelope(envelope).withServiceClientFactory(factory).build(); ArgumentResolverContext input = new ArgumentResolverContext(mockSkillContext, methodParameter, handlerInput); Object resolved = resolver.resolve(input).get(); assertTrue(resolved instanceof ServiceClientFactory); assertSame(factory, resolved); }
@Override public Optional<Object> resolve(ArgumentResolverContext context) { if (context.parameterTypeEquals(ServiceClientFactory.class)) { return Optional.of(context.getHandlerInput().getServiceClientFactory()); } return Optional.empty(); }
ServiceClientFactoryArgumentResolver implements ArgumentResolver { @Override public Optional<Object> resolve(ArgumentResolverContext context) { if (context.parameterTypeEquals(ServiceClientFactory.class)) { return Optional.of(context.getHandlerInput().getServiceClientFactory()); } return Optional.empty(); } }
ServiceClientFactoryArgumentResolver implements ArgumentResolver { @Override public Optional<Object> resolve(ArgumentResolverContext context) { if (context.parameterTypeEquals(ServiceClientFactory.class)) { return Optional.of(context.getHandlerInput().getServiceClientFactory()); } return Optional.empty(); }  }
ServiceClientFactoryArgumentResolver implements ArgumentResolver { @Override public Optional<Object> resolve(ArgumentResolverContext context) { if (context.parameterTypeEquals(ServiceClientFactory.class)) { return Optional.of(context.getHandlerInput().getServiceClientFactory()); } return Optional.empty(); }  @Override Optional<Object> resolve(ArgumentResolverContext context); }
ServiceClientFactoryArgumentResolver implements ArgumentResolver { @Override public Optional<Object> resolve(ArgumentResolverContext context) { if (context.parameterTypeEquals(ServiceClientFactory.class)) { return Optional.of(context.getHandlerInput().getServiceClientFactory()); } return Optional.empty(); }  @Override Optional<Object> resolve(ArgumentResolverContext context);  }