Arquillian Google Guice Extension: BOM

Arquillian Google Guice Bill Of Material

Лицензия

Лицензия

Категории

Категории

JBoss Контейнер Application Servers Arquillian Тестирование приложения и мониторинг GUI Взаимодействие с пользователем Guice Библиотеки уровня приложения Dependency Injection
Группа

Группа

org.jboss.arquillian.extension
Идентификатор

Идентификатор

arquillian-guice-bom
Последняя версия

Последняя версия

1.0.0.Alpha2
Дата

Дата

Тип

Тип

pom
Описание

Описание

Arquillian Google Guice Extension: BOM
Arquillian Google Guice Bill Of Material
Ссылка на сайт

Ссылка на сайт

http://arquillian.org

Скачать arquillian-guice-bom

Имя Файла Размер
arquillian-guice-bom-1.0.0.Alpha2.pom 3 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.jboss.arquillian.extension/arquillian-guice-bom/ -->
<dependency>
    <groupId>org.jboss.arquillian.extension</groupId>
    <artifactId>arquillian-guice-bom</artifactId>
    <version>1.0.0.Alpha2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.jboss.arquillian.extension/arquillian-guice-bom/
implementation 'org.jboss.arquillian.extension:arquillian-guice-bom:1.0.0.Alpha2'
// https://jarcasting.com/artifacts/org.jboss.arquillian.extension/arquillian-guice-bom/
implementation ("org.jboss.arquillian.extension:arquillian-guice-bom:1.0.0.Alpha2")
'org.jboss.arquillian.extension:arquillian-guice-bom:pom:1.0.0.Alpha2'
<dependency org="org.jboss.arquillian.extension" name="arquillian-guice-bom" rev="1.0.0.Alpha2">
  <artifact name="arquillian-guice-bom" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.jboss.arquillian.extension', module='arquillian-guice-bom', version='1.0.0.Alpha2')
)
libraryDependencies += "org.jboss.arquillian.extension" % "arquillian-guice-bom" % "1.0.0.Alpha2"
[org.jboss.arquillian.extension/arquillian-guice-bom "1.0.0.Alpha2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Obsolete

We don't maintain this code base anymore. If you are interested in picking it up from where we left please reach out to us through Arquillian forum.

Guice Test Enricher for Arquillian

  • Injection of Guice dependencies into test classes
  • Auto packaging the guice artifacts.

Code Example

Each Guice enabled test must be annotated with @GuiceConfiguration, the annotion allows to specify multiple modules which will be used for resolving the injected dependencies

Guice Module

public class AppointmentModule implements Module {

    public void configure(Binder binder) {

        binder.bind(AppointmentRepository.class)
                .annotatedWith(Names.named("appointmentRepository"))
                .to(AppointmentRepositoryImpl.class);
        binder.bind(AppointmentService.class)
                .annotatedWith(Names.named("appointmentService"))
                .to(AppointmentServiceImpl.class);
    }
}

Test example

@RunWith(Arquillian.class)
@GuiceConfiguration(AppointmentModule.class)
public class AppointmentServiceImplTestCase {

    @Deployment
    public static JavaArchive createTestArchive() {
        return ShrinkWrap.create(JavaArchive.class, "guice-test.jar")
                .addClasses(Appointment.class,
                        AppointmentRepository.class, AppointmentRepositoryImpl.class,
                        AppointmentService.class, AppointmentServiceImpl.class,
                        AppointmentModule.class);
    }

    @Inject
    @Named("appointmentService")
    private AppointmentService appointmentService;

    @Test
    public void testGetAll() {

        Appointment appointment1 = createAppointment("Important", "Work", new Date());
        Appointment appointment2 = createAppointment("Do not forget", "Work", new Date());

        appointmentService.add(appointment1);
        appointmentService.add(appointment2);

        List<Appointment> result = appointmentService.getAll();
        assertNotNull("Method returned null.", result);
        assertEquals("Invalid element count, 2 appointments were expected.", 2, result.size());
    }

    private Appointment createAppointment(String name, String location, Date date) {

        Appointment appointment = new Appointment();
        appointment.setName(name);
        appointment.setLocation(location);
        appointment.setDate(date);
        return appointment;
    }
}
org.jboss.arquillian.extension

An Innovative Testing Platform for the JVM

Версии библиотеки

Версия
1.0.0.Alpha2
1.0.0.Alpha1