@Test
@SuppressWarnings("rawtypes")
public void testMethodQualifer() throws Exception
{
TestEnricher testEnricher = new DroneTestEnricher();
manager.getContext(ClassContext.class).activate(MethodEnrichedClass.class);
Mockito.when(serviceLoader.all(Configurator.class))
.thenReturn(Arrays.<Configurator> asList(new MockDroneFactory()));
Mockito.when(serviceLoader.all(Instantiator.class))
.thenReturn(Arrays.<Instantiator> asList(new MockDroneFactory()));
Mockito.when(serviceLoader.all(Destructor.class))
.thenReturn(Arrays.<Destructor> asList(new MockDroneFactory()));
Mockito.when(serviceLoader.all(TestEnricher.class))
.thenReturn(Arrays.<TestEnricher> asList(testEnricher));
manager.fire(new BeforeSuite());
DroneRegistry registry = manager.getContext(SuiteContext.class).getObjectStore().get(DroneRegistry.class);
Assert.assertNotNull("Drone registry was created in the context", registry);
Assert.assertTrue("Configurator is of mock type", registry.getConfiguratorFor(MockDroneInstance.class) instanceof MockDroneFactory);
manager.fire(new BeforeClass(MethodEnrichedClass.class));
MethodContext mc = manager.getContext(ClassContext.class).getObjectStore().get(MethodContext.class);
Assert.assertNotNull("Method context object holder was created in the context", mc);
Object instance = new MethodEnrichedClass();
Method testMethod = MethodEnrichedClass.class.getMethod("testMethodEnrichment", MockDroneInstance.class);
manager.inject(testEnricher);
Object[] parameters = testEnricher.resolve(testMethod);
testMethod.invoke(instance, parameters);
}