Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (27 sloc) 1.16 KB

Cuppa is agnostic about which inversion of control container you happen to be using. As such, Cuppa provides a hook to allow you to customise how your test classes are instantiated. To use Guice, you need to write a class that implements ConfigurationProvider and sets the class instantiator:

package com.example;

import org.forgerock.cuppa.ConfigurationProvider;

public final class MyConfigurationProvider implements ConfigurationProvider {
    public void configure(Configuration configuration) {
        // Setup Guice as needed...
        Injector injector = Guice.createInjector(new MyModule());

Cuppa uses a ServiceLoader to find the configuration provider. Hence, you need to provide a configuration file called META-INF/services/org.forgerock.cuppa.ConfigurationProvider that contains the fully-qualified class name of your class:


Ensure that this file is on the classpath when running Cuppa.