-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathSlackClientModuleTest.java
More file actions
43 lines (34 loc) · 1.05 KB
/
SlackClientModuleTest.java
File metadata and controls
43 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.hubspot.slack.client.guice;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.hubspot.slack.client.SlackClientFactory;
import com.hubspot.slack.client.SlackWebClient;
import org.junit.Test;
public class SlackClientModuleTest {
@Test
public void itGuices() {
Guice.createInjector(new StrictGuiceModule()).getInstance(SlackClientFactory.class);
}
private static class StrictGuiceModule extends AbstractModule {
@Override
protected void configure() {
binder().requireAtInjectOnConstructors();
install(new SlackClientModule());
}
}
@Test
public void itCanHaveBothModulesInstalled() {
Injector injector = Guice.createInjector(
new AbstractModule() {
@Override
protected void configure() {
binder().requireAtInjectOnConstructors();
install(new SlackClientModule());
}
}
);
injector.getInstance(SlackClientFactory.class);
injector.getInstance(SlackWebClient.Factory.class);
}
}