Skip to content

Commit

Permalink
test refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
  • Loading branch information
AlexanderWert committed Jun 24, 2023
1 parent 35bc09c commit 96d87e5
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public void elasticsearchStatus() throws IOException {
equalTo(AttributeKey.stringKey("net.protocol.version"), "1.1"),
equalTo(SemanticAttributes.HTTP_URL, httpHost.toURI() + "/"),
equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200L),
equalTo(SemanticAttributes.USER_AGENT_ORIGINAL,
"elastic-java/" + RestClientBuilder.VERSION + " (Java/"
+ System.getProperty("java.version") + ")"),
equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent()),
satisfies(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH,
AbstractLongAssert::isPositive)
)
Expand Down Expand Up @@ -144,15 +142,18 @@ public void elasticsearchIndex() throws IOException {
equalTo(SemanticAttributes.HTTP_URL,
httpHost.toURI() + "/test-index/_doc/test-id?timeout=1s"),
equalTo(SemanticAttributes.HTTP_STATUS_CODE, 201L),
equalTo(SemanticAttributes.USER_AGENT_ORIGINAL,
"elastic-java/" + RestClientBuilder.VERSION + " (Java/"
+ System.getProperty("java.version") + ")"),
equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent()),
satisfies(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH,
AbstractLongAssert::isPositive)
)
));
}

private String userAgent() {
return "elastic-java/" + RestClientBuilder.VERSION + " (Java/"
+ System.getProperty("java.version") + ")";
}

private static class Person {
public final String name;

Expand Down

0 comments on commit 96d87e5

Please sign in to comment.