@SuppressWarnings("unchecked") @Test public void no_annotation() { Class objectType = Runnable.class; AnnotationProvider provider = mockAnnotationProvider(); ObjectLocator locator = mockObjectLocator(); train_getAnnotation(provider, Service.class, null); replay(); ObjectProvider objectProvider = new ServiceAnnotationObjectProvider(); assertNull(objectProvider.provide(objectType, provider, locator)); verify(); }
public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Service annotation = annotationProvider.getAnnotation(Service.class); if (annotation == null) return null; return locator.getService(annotation.value(), objectType); }
ServiceAnnotationObjectProvider implements ObjectProvider { public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Service annotation = annotationProvider.getAnnotation(Service.class); if (annotation == null) return null; return locator.getService(annotation.value(), objectType); } }
ServiceAnnotationObjectProvider implements ObjectProvider { public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Service annotation = annotationProvider.getAnnotation(Service.class); if (annotation == null) return null; return locator.getService(annotation.value(), objectType); }  }
ServiceAnnotationObjectProvider implements ObjectProvider { public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Service annotation = annotationProvider.getAnnotation(Service.class); if (annotation == null) return null; return locator.getService(annotation.value(), objectType); }  T provide(Class<T> objectType, AnnotationProvider annotationProvider,
                         ObjectLocator locator); }
ServiceAnnotationObjectProvider implements ObjectProvider { public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Service annotation = annotationProvider.getAnnotation(Service.class); if (annotation == null) return null; return locator.getService(annotation.value(), objectType); }  T provide(Class<T> objectType, AnnotationProvider annotationProvider,
                         ObjectLocator locator);  }