テスト設定

ebean-test は、テストを実行するための Ebean の設定を行います。

1. ebean-test をテスト依存関係として追加する

<dependency>
  <groupId>io.ebean</groupId>
  <artifactId>ebean-test</artifactId>
  <version>13.25.0</version>
  <scope>test</scope>
</dependency>
dependencies {
    ...
    testCompile 'io.ebean:ebean-test:13.25.0'
}

2. application-test.yaml を追加する

src/test/resourcesに次の application-test.yaml コンフィグレーションファイルを追加します。

ebean:
  test:
    platform: h2 # h2, postgres, mysql, mariadb, oracle, sqlserver, hana, clickhouse, sqlite
    ddlMode: dropCreate # none | dropCreate | migration
    dbName: my_app

platform をサポートされるプラットフォームに変更できます。Ebean のテストは自動的に Docker のテストコンテナを管理して、テストが実行できるように設定します。詳細については、テストを参照してください。