### Question:
UIProvider implements Serializable { protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; }  abstract Class<? extends UI> getUIClass(UIClassSelectionEvent event); UI createInstance(UICreateEvent event); String getTheme(UICreateEvent event); @Deprecated String getWidgetset(UICreateEvent event); WidgetsetInfo getWidgetsetInfo(UICreateEvent event); boolean isPreservedOnRefresh(UICreateEvent event); String getPageTitle(UICreateEvent event); PushMode getPushMode(UICreateEvent event); Transport getPushTransport(UICreateEvent event);  }### Answer:
@Test public void getAnnotationFor_widgetsetAnnotationForSubclass_annotationFound() { Assert.assertNotNull("Widgetset annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, Widgetset.class)); }
@Test public void getAnnotationFor_themeAnnotationForSubclass_annotationFound() { Assert.assertNotNull("Theme annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, Theme.class)); }
@Test public void getAnnotationFor_themeAnnotationForSubclass_annotationOverridden() { Assert.assertEquals( "Theme annotation is not overridden correctly in subclass", "c", UIProvider.getAnnotationFor(TestClass.class, Theme.class) .value()); }
@Test public void getAnnotationFor_notInheritedAnnotationForSubclass_annotationFound() { Assert.assertNotNull( "TestAnnotation annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, TestAnnotation.class)); }
@Test public void getAnnotationFor_directAnnotationForSubclass_annotationFound() { Assert.assertNotNull( "TestAnnotation1 annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, TestAnnotation1.class)); }
@Test public void getAnnotationFor_annotationInheritedFromInterface_annotationFound() { Assert.assertNotNull( "Theme annotation is not inherited from interface", UIProvider .getAnnotationFor(ClassImplementingInterface.class, Theme.class)); }
@Test public void getAnnotationFor_widgetsetAnnotationForSubclass_annotationFound() { assertNotNull("Widgetset annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, Widgetset.class)); }
@Test public void getAnnotationFor_themeAnnotationForSubclass_annotationFound() { assertNotNull("Theme annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, Theme.class)); }
@Test public void getAnnotationFor_themeAnnotationForSubclass_annotationOverridden() { assertEquals("Theme annotation is not overridden correctly in subclass", "c", UIProvider.getAnnotationFor(TestClass.class, Theme.class) .value()); }
@Test public void getAnnotationFor_notInheritedAnnotationForSubclass_annotationFound() { assertNotNull("TestAnnotation annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, TestAnnotation.class)); }
@Test public void getAnnotationFor_directAnnotationForSubclass_annotationFound() { assertNotNull("TestAnnotation1 annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, TestAnnotation1.class)); }
@Test public void getAnnotationFor_annotationInheritedFromInterface_annotationFound() { assertNotNull("Theme annotation is not inherited from interface", UIProvider.getAnnotationFor(ClassImplementingInterface.class, Theme.class)); }