@SuppressWarnings("unchecked") @Test void testResolvesToResourceWhenMessageHandlingMethodHasResourceParameter() { ParameterResolver resolver = testSubject.createInstance(messageHandlingMethodWithResourceParameter, messageHandlingMethodWithResourceParameter.getParameters(), 1); final EventMessage<Object> eventMessage = GenericEventMessage.asEventMessage("test"); assertTrue(resolver.matches(eventMessage)); assertEquals(TEST_RESOURCE, resolver.resolveParameterValue(eventMessage)); }
@Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (Object resource : resources) { if (parameters[parameterIndex].getType().isInstance(resource)) { return new FixedValueParameterResolver<>(resource); } } return null; }
SimpleResourceParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (Object resource : resources) { if (parameters[parameterIndex].getType().isInstance(resource)) { return new FixedValueParameterResolver<>(resource); } } return null; } }
SimpleResourceParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (Object resource : resources) { if (parameters[parameterIndex].getType().isInstance(resource)) { return new FixedValueParameterResolver<>(resource); } } return null; } SimpleResourceParameterResolverFactory(Iterable<?> resources); }
SimpleResourceParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (Object resource : resources) { if (parameters[parameterIndex].getType().isInstance(resource)) { return new FixedValueParameterResolver<>(resource); } } return null; } SimpleResourceParameterResolverFactory(Iterable<?> resources); @Override ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex); }
SimpleResourceParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (Object resource : resources) { if (parameters[parameterIndex].getType().isInstance(resource)) { return new FixedValueParameterResolver<>(resource); } } return null; } SimpleResourceParameterResolverFactory(Iterable<?> resources); @Override ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex);  }