-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAbstractShellIntegrationTest.java
More file actions
52 lines (43 loc) · 1.33 KB
/
AbstractShellIntegrationTest.java
File metadata and controls
52 lines (43 loc) · 1.33 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
44
45
46
47
48
49
50
51
52
package cz.geek.gooddata.shell;
import net.jadler.Jadler;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.shell.Bootstrap;
import org.springframework.shell.core.JLineShellComponent;
/**
* Parent instantiating the shell inside a test case, so we can execute the command and then perform assertions
* on the return value CommandResult.
*/
@RunWith(MockitoJUnitRunner.class)
public abstract class AbstractShellIntegrationTest {
private static JLineShellComponent shell;
private static Bootstrap bootstrap;
@BeforeClass
public static void startUp() {
bootstrap = new Bootstrap();
shell = bootstrap.getJLineShellComponent();
}
@AfterClass
public static void shutdown() {
shell.stop();
}
@Before
public void setUp() {
Jadler.initJadler().withDefaultResponseContentType("application/json");
}
@After
public void tearDown() {
Jadler.closeJadler();
}
public static JLineShellComponent getShell() {
return shell;
}
public static ApplicationContext getContext() {
return bootstrap.getApplicationContext();
}
}