mysql-junit4

Convenience library for using embedded MySQL in Junt4 tests.

Лицензия

Лицензия

Категории

Категории

MySQL Данные Базы данных JUnit Тестирование компонентов
Группа

Группа

com.groupon.mysql
Идентификатор

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

mysql-junit4
Последняя версия

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

0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

mysql-junit4
Convenience library for using embedded MySQL in Junt4 tests.
Ссылка на сайт

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

https://github.com/groupon/mysql-junit4/
Организация-разработчик

Организация-разработчик

Groupon, Inc.
Система контроля версий

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

https://github.com/groupon/mysql-junit4/tree/master

Скачать mysql-junit4

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

<!-- https://jarcasting.com/artifacts/com.groupon.mysql/mysql-junit4/ -->
<dependency>
    <groupId>com.groupon.mysql</groupId>
    <artifactId>mysql-junit4</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.groupon.mysql/mysql-junit4/
implementation 'com.groupon.mysql:mysql-junit4:0.2'
// https://jarcasting.com/artifacts/com.groupon.mysql/mysql-junit4/
implementation ("com.groupon.mysql:mysql-junit4:0.2")
'com.groupon.mysql:mysql-junit4:jar:0.2'
<dependency org="com.groupon.mysql" name="mysql-junit4" rev="0.2">
  <artifact name="mysql-junit4" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.groupon.mysql', module='mysql-junit4', version='0.2')
)
libraryDependencies += "com.groupon.mysql" % "mysql-junit4" % "0.2"
[com.groupon.mysql/mysql-junit4 "0.2"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.groupon.mysql : mysql-embed jar 0.2
junit : junit jar 4.11

provided (2)

Идентификатор библиотеки Тип Версия
org.jdbi : jdbi jar 2.51
com.googlecode.flyway : flyway-core jar 2.2.1

test (1)

Идентификатор библиотеки Тип Версия
org.assertj : assertj-core jar 1.4.0

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

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

JUnit 4 support for Tests against MySQL

This library provides support classes for writing JUnit test against an embedded MySQL instance. The conventional way to use it makes use of JUnit 4 Rules. It basically creates an instance of MySQL, on demand, for testing purposes. It then creates connections to the MySQL database using the standard library (driver) for doing so.

It has additional explicit (optional) support for jdbi and flyway based fixtures.

    /**
     * A ClassRule will be executed before any tests in the class are run,
     * and after all of them are finished.
     */
    @ClassRule public static MySQLRule mysql = MySQLRule.global();

    /**
     * setup() will be run before each test method, and tearDown after
     * each test method.
     */
    @Rule public MySQLRule.Fixtures fixtures = mysql.createFixtures(new JDBIFixture()
    {
        @Override
        protected void before(final Handle handle)
        {
            handle.execute("create table something ( id int primary key, name varchar(255) )");
            PreparedBatch batch = handle.prepareBatch("insert into something (id, name) values (:id, :name)");
            batch.bind("id", 1).bind("name", "Gene").add();
            batch.bind("id", 2).bind("name", "Brian").add();
            batch.execute();
        }

        @Override
        protected void after(final Handle handle)
        {
            handle.execute("drop table something");
        }
    });

This library uses Connector/MXJ to embed MySQL.

Examples

Take a look at MySQLRuleExample and FlywayFixtureExample for sample code using this library.

Getting It

The easiest way is via Maven:

<dependency>
  <groupId>com.groupon.mysql</groupId>
  <artifactId>mysql-junit4</artifactId>
  <version>0.2</version>
  <scope>test</scope>
</dependency>

Licensing

This library is licensed under the 3-Clause BSD License. Note that it relies on MySQL which is GPL, but if you want to test against MySQL you should already know that!

com.groupon.mysql

Groupon

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

Версия
0.2
0.0.1