AnnotatedServiceFactory { public static List<AnnotatedServiceElement> find( String pathPrefix, Object object, boolean useBlockingTaskExecutor, List<RequestConverterFunction> requestConverterFunctions, List<ResponseConverterFunction> responseConverterFunctions, List<ExceptionHandlerFunction> exceptionHandlerFunctions) { final List<Method> methods = requestMappingMethods(object); return methods.stream() .flatMap((Method method) -> create(pathPrefix, object, method, useBlockingTaskExecutor, requestConverterFunctions, responseConverterFunctions, exceptionHandlerFunctions).stream()) .collect(toImmutableList()); } private  AnnotatedServiceFactory(); static List<AnnotatedServiceElement> find(
            String pathPrefix, Object object, boolean useBlockingTaskExecutor,
            List<RequestConverterFunction> requestConverterFunctions,
            List<ResponseConverterFunction> responseConverterFunctions,
            List<ExceptionHandlerFunction> exceptionHandlerFunctions);  }
@Test void testFindAnnotatedServiceElementsWithPathPrefixAnnotation() { final Object object = new PathPrefixServiceObject(); final List<AnnotatedServiceElement> elements = find("/", object, false, ImmutableList.of(), ImmutableList.of(), ImmutableList.of()); final List<String> paths = elements.stream() .map(AnnotatedServiceElement::route) .map(route -> route.paths().get(0)) .collect(Collectors.toList()); assertThat(paths).containsExactlyInAnyOrder(HOME_PATH_PREFIX + "/hello", HOME_PATH_PREFIX + '/'); }
@Test void testFindAnnotatedServiceElementsWithoutPathPrefixAnnotation() { final Object serviceObject = new ServiceObject(); final List<AnnotatedServiceElement> elements = find(HOME_PATH_PREFIX, serviceObject, false, ImmutableList.of(), ImmutableList.of(), ImmutableList.of()); final List<String> paths = elements.stream() .map(AnnotatedServiceElement::route) .map(route -> route.paths().get(0)) .collect(Collectors.toList()); assertThat(paths).containsExactlyInAnyOrder(HOME_PATH_PREFIX + "/hello", HOME_PATH_PREFIX + '/'); }