JPA JUnit5 - Extension Parent

This extension allow you to run Jpa integration tests without having to start any EntityManagerFactory for each test class.

Лицензия

Лицензия

Категории

Категории

JUnit Тестирование компонентов
Группа

Группа

io.github.jlmc
Идентификатор

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

jpa-junit5-parent
Последняя версия

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

1.1
Дата

Дата

Тип

Тип

pom
Описание

Описание

JPA JUnit5 - Extension Parent
This extension allow you to run Jpa integration tests without having to start any EntityManagerFactory for each test class.
Ссылка на сайт

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

https://github.com/jlmc/jpa-junit5-extensions
Система контроля версий

Система контроля версий

https://github.com/jlmc/jpa-junit5-extensions

Скачать jpa-junit5-parent

Имя Файла Размер
jpa-junit5-parent-1.1.pom 8 KB
Обзор

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

<!-- https://jarcasting.com/artifacts/io.github.jlmc/jpa-junit5-parent/ -->
<dependency>
    <groupId>io.github.jlmc</groupId>
    <artifactId>jpa-junit5-parent</artifactId>
    <version>1.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.github.jlmc/jpa-junit5-parent/
implementation 'io.github.jlmc:jpa-junit5-parent:1.1'
// https://jarcasting.com/artifacts/io.github.jlmc/jpa-junit5-parent/
implementation ("io.github.jlmc:jpa-junit5-parent:1.1")
'io.github.jlmc:jpa-junit5-parent:pom:1.1'
<dependency org="io.github.jlmc" name="jpa-junit5-parent" rev="1.1">
  <artifact name="jpa-junit5-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.github.jlmc', module='jpa-junit5-parent', version='1.1')
)
libraryDependencies += "io.github.jlmc" % "jpa-junit5-parent" % "1.1"
[io.github.jlmc/jpa-junit5-parent "1.1"]

Зависимости

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

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

  • jpa-junit5-extension

Java CI with Maven Maven Central

JPA JUnit 5 Extensions

This extension allow you to run Jpa integration tests without having to start any EntityManagerFactory for each test class.

How to use it?

Add the following dependency to your project:

<dependency>
  <groupId>io.github.jlmc</groupId>
  <artifactId>jpa-junit5-extension</artifactId>
  <version>1.1</version>
  <scope>test</scope>
</dependency>

NOTE:

This project depends on:

  • javax.persistence-api 2.2
  • JUnit Jupiter 5.6.2

Add the @JpaTest annotation to your test class. By default, Jpa EntityManagerFactory will be started in the callback BeforeAllCallback#beforeAll. Using the @JpaTest annotation to your test class, allows you to inject an instance of EntityManager, EntityManagerFactory or JpaProvider for each execution of the test methods:

@JpaTest( persistenceUnit = "it" )
class JUnit5Test {

    @JpaContext
    private JpaProvider jpa;

    @Test
    void createBook() {
        EntityManager em = jpa.em();
        em.getTransaction().begin();

        em.persist(new Book().setTitle("The Great Gatsby"));

        em.getTransaction().commit();

        em.close();
    }
}

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

Версия
1.1
1.0