MDSInterfaceResolver { public static void processMDSInterfaces(Bundle bundle) { LOGGER.debug("Starting to look for MotechDataService implementations in bundle {}", bundle.getSymbolicName()); List<Class<? extends MotechDataService>> allBundleInterfaces = ReflectionsUtil.getMdsInterfaces(bundle); for (Class clazz : allBundleInterfaces) { LOGGER.debug("Processing {} class", clazz.getName()); Type[] interfaces = clazz.getGenericInterfaces(); ParameterizedType parameterizedType = findMDSInterface(interfaces); LOGGER.info("Registering {} service in MotechClassPool", clazz.getName()); MotechClassPool.registerServiceInterface(discoverEntityClassName(parameterizedType), clazz.getName()); } } private  MDSInterfaceResolver(); static void processMDSInterfaces(Bundle bundle);  }
@Test public void shouldDiscoverMotechDataServiceInPackage() throws MalformedURLException, ClassNotFoundException { mockStatic(MotechClassPool.class); MDSInterfaceResolver.processMDSInterfaces(bundle); verifyStatic(); MotechClassPool.registerServiceInterface("org.motechproject.mds.annotations.internal.samples.Sample", "org.motechproject.mds.reflections.test.TestMDService"); verifyStatic(); MotechClassPool.registerServiceInterface("org.motechproject.mds.builder.SampleWithLookups", "org.motechproject.mds.reflections.test.ComplicatedService"); }