How to use in memory database with injected test with java game

play documentation on functional tests in java shows two modes

  • using the fakeApplication function to specify a custom configuration (in the database database in the example)
  • using dependency injection to configure the application

I would like to use dependency injection, but I need to configure a user configuration when the application starts, like using memory in a database.

I can not do it. I assume this needs to be done in the guice creator, but I don't know how to do it.

+6
source share
1 answer

I assume you are using Guice for DI.

A discussion of question 4809 in the github repo framework should help answer your question.

I managed to get it to work using one of the solutions to the problem:

new GuiceApplicationBuilder() .configure((Map) Helpers.inMemoryDatabase()) .in(Mode.TEST) .build(); 
+5
source

Source: https://habr.com/ru/post/988562/


All Articles