BeanMethodMatcher implements Matcher { @Override public Set<foundation.stack.datamill.http.Method> queryOptions(ServerRequest request) { EnumSet<foundation.stack.datamill.http.Method> methods = EnumSet.noneOf(foundation.stack.datamill.http.Method.class); for (Matcher matcher : matchers) { Set<foundation.stack.datamill.http.Method> matchedMethods = matcher.queryOptions(request); if (matchedMethods != null) { methods.addAll(matchedMethods); } } if (!methods.isEmpty()) { return methods; } return null; } BeanMethodMatcher(
            Bean<?> bean,
            BiFunction<ServerRequest, Method, Observable<Response>> route); @Override Observable<Response> applyIfMatches(ServerRequest request); @Override Set<foundation.stack.datamill.http.Method> queryOptions(ServerRequest request);  }
@Test public void queryOptions() { TestBeanWithOnlyBeanPath bean = new TestBeanWithOnlyBeanPath(); BeanMethodMatcher matcher = new BeanMethodMatcher( OutlineBuilder.DEFAULT.wrap(bean), (request, method) -> method.invoke(bean)); ServerRequest request = mock(ServerRequest.class); when(request.method()).thenReturn(Method.OPTIONS); when(request.uri()).thenReturn("/test"); assertThat(matcher.queryOptions(request), hasItems(Method.GET, Method.POST)); when(request.method()).thenReturn(Method.OPTIONS); when(request.uri()).thenReturn("/abc"); assertNull(matcher.queryOptions(request)); }