@Test public void createCreationFactoryOnParametrisedMethodWithClassParam() throws Exception { Path classPath = Mockito.mock(Path.class); Path methodPath = Mockito.mock(Path.class); OslcCreationFactory creationFactoryAnnotation = Mockito.mock(OslcCreationFactory.class); Mockito.when(classPath.value()).thenReturn("mockService/{id}"); Mockito.when(methodPath.value()).thenReturn("mockFactory/{id}"); Mockito.when(creationFactoryAnnotation.resourceShapes()).thenReturn(new String[0]); Mockito.when(creationFactoryAnnotation.resourceTypes()).thenReturn(new String[0]); Mockito.when(creationFactoryAnnotation.usages()).thenReturn(new String[0]); HashMap<String, Object> pathParameterValues = new HashMap<>(); pathParameterValues.put("id", ID_VALUE); CreationFactory creationFactory = ServiceProviderFactory.createCreationFactory(FAKE_BASE, pathParameterValues, classPath, creationFactoryAnnotation, methodPath); assertEquals(getUri("mockService/23/mockFactory/23"), creationFactory.getCreation().toString()); }
static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.getAnnotation( OslcCreationFactory.class); final Path methodPathAnnotation = method.getAnnotation(Path.class); CreationFactory creationFactory = createCreationFactory(baseURI, pathParameterValues, classPathAnnotation, creationFactoryAnnotation, methodPathAnnotation); return creationFactory; }
ServiceProviderFactory { static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.getAnnotation( OslcCreationFactory.class); final Path methodPathAnnotation = method.getAnnotation(Path.class); CreationFactory creationFactory = createCreationFactory(baseURI, pathParameterValues, classPathAnnotation, creationFactoryAnnotation, methodPathAnnotation); return creationFactory; } }
ServiceProviderFactory { static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.getAnnotation( OslcCreationFactory.class); final Path methodPathAnnotation = method.getAnnotation(Path.class); CreationFactory creationFactory = createCreationFactory(baseURI, pathParameterValues, classPathAnnotation, creationFactoryAnnotation, methodPathAnnotation); return creationFactory; } private  ServiceProviderFactory(); }
ServiceProviderFactory { static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.getAnnotation( OslcCreationFactory.class); final Path methodPathAnnotation = method.getAnnotation(Path.class); CreationFactory creationFactory = createCreationFactory(baseURI, pathParameterValues, classPathAnnotation, creationFactoryAnnotation, methodPathAnnotation); return creationFactory; } private  ServiceProviderFactory(); static ServiceProvider createServiceProvider(final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses); static ServiceProvider createServiceProvider(final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses, final Map<String,Object> pathParameterValues); static ServiceProvider initServiceProvider(final ServiceProvider serviceProvider, final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses, final Map<String,Object> pathParameterValues); }
ServiceProviderFactory { static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.getAnnotation( OslcCreationFactory.class); final Path methodPathAnnotation = method.getAnnotation(Path.class); CreationFactory creationFactory = createCreationFactory(baseURI, pathParameterValues, classPathAnnotation, creationFactoryAnnotation, methodPathAnnotation); return creationFactory; } private  ServiceProviderFactory(); static ServiceProvider createServiceProvider(final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses); static ServiceProvider createServiceProvider(final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses, final Map<String,Object> pathParameterValues); static ServiceProvider initServiceProvider(final ServiceProvider serviceProvider, final String baseURI, final String genericBaseURI, final String title, final String description, final Publisher publisher, final Class<?>[] resourceClasses, final Map<String,Object> pathParameterValues);  }