I have different plugins implemented the Plugin
interface. Now I have them hard-coded in play.plugins like this:
100:test.A
200:test.B
However in my unit tests I don't want both of them to be loaded at one time. In other words, in test A I want to load only plugin A and in test B load B only. Instead of changing the configuration file manually, is there a way to change it programmatically? I guess when fakeApplication()
is invoked all plugins are loaded by default.
You can start a
FakeApplication
with added or excluded plugins and also with custom configuration.Here is an example in scala (I believe the Java API has an equivalent mechanism) :
In Java, you can use one of the
fakeApplication
static methods available in theplay.test.Helpers
class. Here is the equivalent of the scala example :