Package org.jboss.arquillian.test.spi

Examples of org.jboss.arquillian.test.spi.TestEnricher


    @org.junit.Before
    public void setMocks() {
        ArquillianDescriptor desc = Descriptors.create(ArquillianDescriptor.class).extension("mockdrone")
            .property("field", "foobar");

        TestEnricher testEnricher = new DroneTestEnricher();
        getManager().inject(testEnricher);

        bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
        bind(ApplicationScoped.class, ArquillianDescriptor.class, desc);
        Mockito.when(serviceLoader.all(Configurator.class)).thenReturn(
View Full Code Here


        // was not instantiated yet
        assertEventFired(BeforeDroneInstantiated.class, 0);
        assertEventFired(AfterDroneInstantiated.class, 0);

        TestEnricher testEnricher = serviceLoader.onlyOne(TestEnricher.class);
        testEnricher.enrich(instance);

        // enriched did the instantiation
        assertEventFired(BeforeDroneInstantiated.class, 2);
        assertEventFired(AfterDroneInstantiated.class, 2);

        Object[] dummyParameters = testEnricher.resolve(testDummyMethod);

        assertEventFired(BeforeDroneInstantiated.class, 2);
        assertEventFired(AfterDroneInstantiated.class, 2);

        testDummyMethod.invoke(instance, dummyParameters);
View Full Code Here

   {
      Mockito.when(
            resourceProvider.lookup(ObjectClass.class.getField("resource").getAnnotation(ArquillianResource.class)))
            .thenReturn(resource);

      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);

      ObjectClass test = new ObjectClass();
      enricher.enrich(test);

      Assert.assertEquals(resource, test.resource);
   }
View Full Code Here

      Annotation resourceAnnotation = resourceMethod.getParameterAnnotations()[0][0];

      Mockito.when(
            resourceProvider.lookup((ArquillianResource)resourceAnnotation)).thenReturn(resource);

      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);

      Object[] result = enricher.resolve(resourceMethod);

      Assert.assertEquals(resource, result[0]);
   }
View Full Code Here

      Mockito.when(
            resourceProvider.lookup(resource2Field.getAnnotation(ArquillianResource.class), resource2Field.getAnnotation(ArquillianTestQualifier.class)))
            .thenReturn(resource);

      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);

      ObjectClass2 test = new ObjectClass2();
      enricher.enrich(test);

      Assert.assertEquals(resource, test.resource2);
   }
View Full Code Here

      Mockito.when(
            resourceProvider.lookup((ArquillianResource)resourceAnnotation, resourceMethod.getParameterAnnotations()[0][1]))
            .thenReturn(resource);

      TestEnricher enricher = new ArquillianResourceTestEnricher();
      injector.get().inject(enricher);

      Object[] result = enricher.resolve(resourceMethod);

      Assert.assertEquals(resource, result[0]);
   }
View Full Code Here

    public void setUp() {
        ArquillianDescriptor desc = Descriptors.create(ArquillianDescriptor.class).extension("mockdrone-different")
                .property("field", DIFFERENT_FIELD).extension("mockdrone-methodargumentone")
                .property("field", METHOD_ARGUMENT_ONE_FIELD);

        TestEnricher testEnricher = new DroneTestEnricher();
        getManager().inject(testEnricher);

        bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
        bind(ApplicationScoped.class, ArquillianDescriptor.class, desc);
View Full Code Here

        fire(new Before(instance, testMethod));

        DronePoint<MockDrone> dronePoint = new DronePointImpl<MockDrone>(MockDrone.class, DronePoint.Lifecycle.METHOD,
                AnnotationMocks.drone(), AnnotationMocks.methodArgumentOneQualifier());

        TestEnricher testEnricher = serviceLoader.onlyOne(TestEnricher.class);

        testEnricher.enrich(instance);
        Object[] parameters = testEnricher.resolve(testMethod);

        assertTrue("Drone is created", context.get(dronePoint).isInstantiated());
        assertEquals("Drone was enhanced with both enhancers", enhanced2, context.get(dronePoint).getInstance());
        assertNotNull(notEnhanced);
View Full Code Here

    public void setMocks() {
        ArquillianDescriptor desc = Descriptors.create(ArquillianDescriptor.class).extension("mockdrone-different")
                .property("field", DIFFERENT_FIELD).extension("mockdrone-methodargumentone")
                .property("field", METHOD_ARGUMENT_ONE_FIELD);

        TestEnricher testEnricher = new DroneTestEnricher();
        //DroneInstanceCreator instanceCreator = new DroneInstanceCreator();
        getManager().inject(testEnricher);

        bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
        bind(ApplicationScoped.class, ArquillianDescriptor.class, desc);
View Full Code Here

                registry.getEntryFor(MockDrone.class, Instantiator.class) instanceof MockDroneFactory);

        fire(new BeforeClass(MethodEnrichedClass.class));
        fire(new Before(instance, testMethod));

        TestEnricher testEnricher = serviceLoader.onlyOne(TestEnricher.class);

        testEnricher.enrich(instance);
        Object[] parameters = testEnricher.resolve(testMethod);

        DronePoint<MockDrone> dronePoint = new DronePointImpl<MockDrone>(MockDrone.class, DronePoint.Lifecycle.METHOD,
                AnnotationMocks.drone(), AnnotationMocks.methodArgumentOneQualifier());
        Assert.assertTrue("Drone created", context.get(dronePoint).isInstantiated());
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.test.spi.TestEnricher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.