### Question:
FHIRRequestFeature implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { if (resourceInfo.getResourceMethod().getAnnotation(FHIR.class) != null || resourceInfo.getResourceClass().getAnnotation(FHIR.class) != null) { context.register(FHIRRequestFilter.class); return; } if (resourceInfo.getResourceMethod().getAnnotation(FHIRAsync.class) != null || resourceInfo.getResourceClass().getAnnotation(FHIRAsync.class) != null) { context.register(FHIRAsyncRequestFilter.class); } } @Inject  FHIRRequestFeature(); @Override void configure(ResourceInfo resourceInfo, FeatureContext context);  }### Answer:
@Test void testFHIRResourceAnnotation() { Mockito.when(method.getAnnotation(FHIR.class)).thenReturn(this.fhirAnnotation); Mockito.when(info.getResourceMethod()).thenReturn(method); feature.configure(info, context); Mockito.verify(context, Mockito.times(1)).register(FHIRRequestFilter.class); }
@Test void testFHIRClassAnnotation() { Mockito.when(method.getAnnotation(FHIR.class)).thenReturn(null); Mockito.when(info.getResourceClass()).thenAnswer(answer -> FHIRResourceClass.class); Mockito.when(info.getResourceMethod()).thenReturn(method); feature.configure(info, context); Mockito.verify(context, Mockito.times(1)).register(FHIRRequestFilter.class); }
@Test void testAsyncFHIRResourceAnnotation() { Mockito.when(info.getResourceClass()).thenAnswer(answer -> FHIRAsyncResourceClass.class); Mockito.when(method.getAnnotation(FHIRAsync.class)).thenReturn(this.asyncAnnotation); Mockito.when(info.getResourceMethod()).thenReturn(method); feature.configure(info, context); Mockito.verify(context, Mockito.times(1)).register(FHIRAsyncRequestFilter.class); }
@Test void testAsyncFHIRClassAnnotation() { Mockito.when(info.getResourceClass()).thenAnswer(answer -> FHIRAsyncResourceClass.class); Mockito.when(info.getResourceMethod()).thenReturn(method); feature.configure(info, context); Mockito.verify(context, Mockito.times(1)).register(FHIRAsyncRequestFilter.class); }
@Test void testNoAnnotation() { Mockito.when(info.getResourceClass()).thenAnswer(answer -> NoAnnotationClass.class); Mockito.when(info.getResourceMethod()).thenReturn(method); feature.configure(info, context); Mockito.verify(context, Mockito.never()).register(Mockito.any()); }