Skip to content

Commit ab14344

Browse files
committed
Implement Test Case for Single Endpoint
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent 8475311 commit ab14344

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/test/java/io/securecodebox/persistence/defectdojo/service/EndpointServiceTest.java

+41-1
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,48 @@ void search_withQueryParams() throws URISyntaxException, IOException {
102102
}
103103

104104
@Test
105-
@Disabled("TODO: Implement test.")
106105
void get_byId() {
106+
final var response = """
107+
{
108+
"id": 42,
109+
"tags": [],
110+
"protocol": "tcp",
111+
"userinfo": null,
112+
"host": "www.owasp.org",
113+
"port": 443,
114+
"path": null,
115+
"query": null,
116+
"fragment": null,
117+
"product": 285,
118+
"endpoint_params": [],
119+
"findings": [
120+
34706,
121+
34684,
122+
34679,
123+
34677
124+
],
125+
"prefetch": {}
126+
}
127+
""";
128+
stubFor(
129+
get("/api/v2/endpoints/42")
130+
.willReturn(
131+
ok()
132+
.withHeaders(responseHeaders(response.length()))
133+
.withBody(response)
134+
)
135+
);
136+
final var expected = Endpoint.builder()
137+
.id(42)
138+
.protocol("tcp")
139+
.host("www.owasp.org")
140+
.port(443)
141+
.product(285)
142+
.build();
143+
144+
final var result = sut.get(42L);
145+
146+
assertThat(result, is(expected));
107147
}
108148

109149

0 commit comments

Comments
 (0)