-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathRedmineClientTest.java
More file actions
39 lines (29 loc) · 1.32 KB
/
RedmineClientTest.java
File metadata and controls
39 lines (29 loc) · 1.32 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
package com.example.linkedcontainer;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.testcontainers.containers.PostgreSQLContainer;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for RedmineClient.
*/
public class RedmineClientTest {
private static final String POSTGRES_USERNAME = "redmine";
private static final String POSTGRES_PASSWORD = "secret";
private PostgreSQLContainer<?> postgreSQLContainer = new PostgreSQLContainer<>(
LinkedContainerTestImages.POSTGRES_TEST_IMAGE
)
.withUsername(POSTGRES_USERNAME)
.withPassword(POSTGRES_PASSWORD);
private RedmineContainer redmineContainer = new RedmineContainer(LinkedContainerTestImages.REDMINE_TEST_IMAGE)
.withLinkToContainer(postgreSQLContainer, "postgres")
.withEnv("POSTGRES_ENV_POSTGRES_USER", POSTGRES_USERNAME)
.withEnv("POSTGRES_ENV_POSTGRES_PASSWORD", POSTGRES_PASSWORD);
@Rule
public RuleChain chain = RuleChain.outerRule(postgreSQLContainer).around(redmineContainer);
@Test
public void canGetIssueCount() throws Exception {
RedmineClient redmineClient = new RedmineClient(redmineContainer.getRedmineUrl());
assertThat(redmineClient.getIssueCount()).as("The issue count can be retrieved.").isZero();
}
}