Skip to content

Commit c8fa5e0

Browse files
committed
Capture & Replay Integration Test for ProductGroupService
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent c603210 commit c8fa5e0

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
package io.securecodebox.persistence.defectdojo.service;
22

3+
import io.securecodebox.persistence.defectdojo.model.ProductGroup;
4+
import org.junit.jupiter.api.Disabled;
35
import org.junit.jupiter.api.Test;
46

5-
import static org.junit.jupiter.api.Assertions.*;
7+
import java.io.IOException;
8+
import java.net.URISyntaxException;
9+
10+
import static com.github.tomakehurst.wiremock.client.WireMock.*;
611
import static org.hamcrest.MatcherAssert.assertThat;
7-
import static org.hamcrest.Matchers.*;
12+
import static org.hamcrest.Matchers.containsInAnyOrder;
13+
import static org.hamcrest.Matchers.hasSize;
14+
import static org.junit.jupiter.api.Assertions.assertAll;
815

916
/**
1017
* Tests for {@link ProductGroupService}
1118
*/
12-
final class ProductGroupServiceTest extends WireMockBaseTestCase{
19+
final class ProductGroupServiceTest extends WireMockBaseTestCase {
1320
private final ProductGroupService sut = new ProductGroupService(conf());
21+
22+
@Test
23+
@Disabled("TODO: Add non-empty fixture for ProductGroupService.")
24+
void search() throws URISyntaxException, IOException {
25+
stubFor(
26+
get("/api/v2/product_groups/?offset=0&limit=100")
27+
.willReturn(
28+
ok()
29+
.withBody(readResponseBodyFromFixture("ProductGroupService_response_fixture.json"))
30+
)
31+
);
32+
33+
final var result = sut.search();
34+
35+
assertAll(
36+
() -> assertThat(result, hasSize(0)),
37+
() -> assertThat(result, containsInAnyOrder(
38+
ProductGroup.builder().build()
39+
))
40+
);
41+
}
1442
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
{}
1+
{
2+
"count": 0,
3+
"next": null,
4+
"previous": null,
5+
"results": [],
6+
"prefetch": {}
7+
}

0 commit comments

Comments
 (0)