@Test void testResolversQueriedInOrderProvided() throws Exception { Method equals = getClass().getMethod("equals", Object.class); ParameterResolver factory = testSubject.createInstance(equals, equals.getParameters(), 0); assertFalse(factory.matches(null)); InOrder inOrder = inOrder(mockFactory1, mockFactory2, mockResolver1, mockResolver2); inOrder.verify(mockFactory1).createInstance(ArgumentMatchers.any(Executable.class), ArgumentMatchers.any(), ArgumentMatchers.anyInt()); inOrder.verify(mockResolver1).matches(any()); verify(mockFactory2, never()).createInstance(ArgumentMatchers.any(Executable.class), ArgumentMatchers.any(), ArgumentMatchers.anyInt()); verify(mockResolver2, never()).matches(any(Message.class)); }
@Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (ParameterResolverFactory factory : factories) { ParameterResolver resolver = factory.createInstance(executable, parameters, parameterIndex); if (resolver != null) { return resolver; } } return null; }
MultiParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (ParameterResolverFactory factory : factories) { ParameterResolver resolver = factory.createInstance(executable, parameters, parameterIndex); if (resolver != null) { return resolver; } } return null; } }
MultiParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (ParameterResolverFactory factory : factories) { ParameterResolver resolver = factory.createInstance(executable, parameters, parameterIndex); if (resolver != null) { return resolver; } } return null; } MultiParameterResolverFactory(ParameterResolverFactory... delegates);  MultiParameterResolverFactory(List<ParameterResolverFactory> delegates); }
MultiParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (ParameterResolverFactory factory : factories) { ParameterResolver resolver = factory.createInstance(executable, parameters, parameterIndex); if (resolver != null) { return resolver; } } return null; } MultiParameterResolverFactory(ParameterResolverFactory... delegates);  MultiParameterResolverFactory(List<ParameterResolverFactory> delegates); static MultiParameterResolverFactory ordered(ParameterResolverFactory... delegates); static MultiParameterResolverFactory ordered(List<ParameterResolverFactory> delegates); List<ParameterResolverFactory> getDelegates(); @Override ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex); }
MultiParameterResolverFactory implements ParameterResolverFactory { @Override public ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex) { for (ParameterResolverFactory factory : factories) { ParameterResolver resolver = factory.createInstance(executable, parameters, parameterIndex); if (resolver != null) { return resolver; } } return null; } MultiParameterResolverFactory(ParameterResolverFactory... delegates);  MultiParameterResolverFactory(List<ParameterResolverFactory> delegates); static MultiParameterResolverFactory ordered(ParameterResolverFactory... delegates); static MultiParameterResolverFactory ordered(List<ParameterResolverFactory> delegates); List<ParameterResolverFactory> getDelegates(); @Override ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex);  }