Hi,
I'm holding onto the Guiceberry tutorial and create this junit3 test using Guiceberry, but it's throwing the following exception:
java.lang.RuntimeException: Binding error in the GuiceBerry Env 'com.google.ads.api.services.testing.functional.FunctionalTestGuiceberryEnvironment': 'Guice configuration errors:
1) No implementation for com.google.ads.common.constants.CurrencyRepository was bound.
while locating com.google.ads.common.constants.CurrencyRepository
for field at com.google.ads.api.services.testing.functional.tests.datax.DataxServiceTest.currencyRepository(DataxServiceTest.java:52)
while locating com.google.contentads.usertargeting.datax.pubsub.ddpsharelists.DdpShareListsActionTest
1 error'.
at com.google.guiceberry.GuiceBerryUniverse$TestCaseScaffolding.injectMembersIntoTest(GuiceBerryUniverse.java:175)
at com.google.guiceberry.GuiceBerryUniverse$TestCaseScaffolding.runBeforeTest(GuiceBerryUniverse.java:117)
at com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.doSetUp(GuiceBerryJunit3.java:155)
at com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.setUp(GuiceBerryJunit3.java:136)
at com.google.ads.api.services.testing.functional.AbstractServiceTest.doGuiceBerryJunit3SetUp(AbstractServiceTest.java:221)
at com.google.ads.api.services.testing.functional.AbstractServiceTest.setUp(AbstractServiceTest.java:174)
at com.google.ads.api.services.testing.functional.tests.datax.DataxServiceTest.setUp(DataxServiceTest.java:89)
at com.google.contentads.usertargeting.datax.pubsub.ddpsharelists.DdpShareListsActionTest.setUp(DdpShareListsActionTest.java:100)
at com.google.common.testing.junit3.TearDownTestCase.runBare(TearDownTestCase.java:116)
===============================================================================================
DdpShareListsActionTest.java
package com.google.contentads.usertargeting.datax.pubsub.ddpsharelists;
...
/**
* An integration test for {@link DdpShareListsAction}.
*/
@ApiServices(
value = {UserListClientService.class, UserListService.class, DdpCustomerMappingService.class})
@GuiceBerryEnv(GuiceberryEnvironmentNames.FUNCTIONAL_ENVIRONMENT)
@LargeTest
public class DdpShareListsActionTest extends DataxServiceTest {
private static class NoDryRunModule extends AbstractModule {
@Override
protected void configure() {
bind(Key.get(Boolean.class, Names.named("dryRun"))).toInstance(false);
}
}
protected DdpCustomerMappingService ddpCustomerMappingService;
protected UserListClientService userListClientService;
protected DdpShareListsAction ddpShareListsAction;
protected final String scionUserListName = "ScionUserList";
protected final String mccUserListName = "MccUserList";
protected ApiTestAdvertiser scionOwnerCustomer;
protected ApiTestAdvertiser mccManagerCustomer;
protected ApiTestAdvertiser clientCustomer;
protected List<UserList> testScionUserLists;
protected List<UserList> testMccUserLists;
protected int userListNameSuffix = 1;
protected BoulderTestingEnvironment boulderEnv;
private TearDown toTearDown;
public DdpShareListsActionTest() {
boulderEnv = new BoulderTestingEnvironment();
addEnvironment(boulderEnv);
}
@Override
public void setUp() throws Exception{
super.setUp();
toTearDown = ManualTearDownGuiceBerry.setUp(this, DdpGuiceberryEnv.class);
Injector injector = boulderEnv.getInjector();
tas = injector.getInstance(ApiTestAdvertiserService.class);
ddpCustomerMappingService = makeClient(DdpCustomerMappingService.class);
userListClientService = makeClient(UserListClientService.class);
userListService = makeClient(UserListService.class);
ddpShareListsAction = new DdpShareListsAction(
userListClientService,
userListService,
ddpCustomerMappingService,
false,
200);
scionOwnerCustomer = dtas.createAdvertiserForExternalSystem(
new TestAdvertiserData(), Product.SCION);
mccManagerCustomer = dtas.createAdvertiserWithIds(
new TestAdvertiserData().whitelistForFeature(ProductFeature.LICENSED_USER_LISTS_TAB));
clientCustomer = dtas.createAdvertiserWithIds(
new TestAdvertiserData().whitelistForFeature(ProductFeature.LICENSED_USER_LISTS_TAB));
dtas.setNamedInjectableValue("systemAccountsCustomerIdSet",
Long.toString(scionOwnerCustomer.getCustomerId()));
testScionUserLists = createUserLists(
scionUserListName, scionOwnerCustomer, 2, EntityNamespaceSubtype.SCION_APP, 1000L);
List<UserList> testMccUserLists = createUserLists(
mccUserListName, mccManagerCustomer, 2, null, null);
addTearDown(new TearDown() {
@Override
public void tearDown() throws Exception {
toTearDown.tearDown();
}
});
}
....
}