|
1 | 1 | package io.securecodebox.persistence.defectdojo.service;
|
2 | 2 |
|
| 3 | +import io.securecodebox.persistence.defectdojo.model.ProductGroup; |
| 4 | +import org.junit.jupiter.api.Disabled; |
3 | 5 | import org.junit.jupiter.api.Test;
|
4 | 6 |
|
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.*; |
6 | 11 | 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; |
8 | 15 |
|
9 | 16 | /**
|
10 | 17 | * Tests for {@link ProductGroupService}
|
11 | 18 | */
|
12 |
| -final class ProductGroupServiceTest extends WireMockBaseTestCase{ |
| 19 | +final class ProductGroupServiceTest extends WireMockBaseTestCase { |
13 | 20 | 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 | + } |
14 | 42 | }
|
0 commit comments