Skip to content

Commit

Permalink
Identataion only
Browse files Browse the repository at this point in the history
  • Loading branch information
kifj committed Feb 25, 2024
1 parent b1f9e3f commit 126347c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/test/java/x1/stomp/test/ContainerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ public class ContainerTest {
private static final String PATH_PARAM_KEY = "{key}";
private static final String PARAM_KEY = "key";
private static final String TEST_SHARE = "AAPL";
private static final String TEST_SHARE_INVALID = "XXXX";

private static Network network = Network.builder().build();

@Container
private static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:15-alpine")
.withNetwork(network).withNetworkAliases("postgres").withDatabaseName("stocks")
.withInitScript("init.sql");
.withNetwork(network)
.withNetworkAliases("postgres")
.withDatabaseName("stocks")
.withInitScript("init.sql");

@SuppressWarnings("rawtypes")
@Container
private static GenericContainer<?> wildfly = new GenericContainer(DockerImageName.parse("registry.x1/j7beck/x1-wildfly-stomp-test:1.8"))
.dependsOn(postgres).withNetwork(network)
Expand Down Expand Up @@ -80,7 +82,7 @@ public void tearDown() {
@Test
public void testFindShareNotFound() {
try (var response = client.target(baseUrl).path(PATH_SHARES).path(PATH_PARAM_KEY)
.resolveTemplate(PARAM_KEY, TEST_SHARE).request(APPLICATION_JSON).get()) {
.resolveTemplate(PARAM_KEY, TEST_SHARE).request(APPLICATION_JSON).get()) {
assertThat(response).hasStatus(NOT_FOUND);
}
}
Expand All @@ -91,14 +93,14 @@ public void testAddShareInvalid() {
var share = new Share(key);

try (var response = client.target(baseUrl).path(PATH_SHARES).request(APPLICATION_JSON)
.post(Entity.entity(share, MediaType.APPLICATION_XML))) {
.post(Entity.entity(share, MediaType.APPLICATION_XML))) {
assertThat(response).hasStatus(BAD_REQUEST);
var errorResponse = response.readEntity(ErrorResponse.class);
assertThat(errorResponse).isNotNull().containsErrors(2).hasRequestUri().hasType("Invalid data");
}

try (var response = client.target(baseUrl).path(PATH_SHARES).path(PATH_PARAM_KEY).resolveTemplate(PARAM_KEY, key)
.request(APPLICATION_JSON).get()) {
.request(APPLICATION_JSON).get()) {
assertThat(response).hasStatus(NOT_FOUND);
}
}
Expand Down

0 comments on commit 126347c

Please sign in to comment.