Skip to content

Commit

Permalink
Merge pull request #16 from kyle-winkelman/JvmStatic
Browse files Browse the repository at this point in the history
Add @JvmStatic to companion object methods for ease of use with other JVM languages.
  • Loading branch information
nilwurtz authored Dec 12, 2023
2 parents 1bab403 + 8132329 commit 44f3bcf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/testcontainers-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<wiremock.testcontainers.version>1.0-alpha-13</wiremock.testcontainers.version>
<testcontainers.version>1.19.0</testcontainers.version>
<extension.version>0.7.0</extension.version>
<extension.version>0.8.0</extension.version>
<wiremock.version>3.3.1</wiremock.version>
<junit.version>5.10.1</junit.version>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion examples/testcontainers-java/src/test/java/TestSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testGraphql() throws IOException, InterruptedException {
WireMock.post(WireMock.urlEqualTo("/graphql"))
.andMatching(
GraphqlBodyMatcher.extensionName,
GraphqlBodyMatcher.Companion.withRequest(
GraphqlBodyMatcher.withRequest(
"{ \"query\": \"{ query { name id }}\" }"
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class GraphqlBodyMatcher() : RequestMatcherExtension() {
* @throws InvalidQueryException if the given query is invalid.
*/
@Deprecated("This method will be deleted in a future release. Use withRequestJson instead.")
@JvmStatic
@JvmOverloads
fun withRequestQueryAndVariables(expectedQuery: String, expectedVariables: String? = null): GraphqlBodyMatcher {
// Avoid to parse json here. It will be parsed in initExpectedRequestJson
return GraphqlBodyMatcher().apply {
Expand All @@ -52,6 +54,7 @@ class GraphqlBodyMatcher() : RequestMatcherExtension() {
* @throws InvalidJsonException if the given JSON is malformed.
* @throws InvalidQueryException if the given query is invalid.
*/
@JvmStatic
fun withRequestJson(expectedJson: String): GraphqlBodyMatcher {
return GraphqlBodyMatcher().apply {
initExpectedRequestJson(expectedJson)
Expand All @@ -68,6 +71,7 @@ class GraphqlBodyMatcher() : RequestMatcherExtension() {
* @throws InvalidJsonException if the given JSON is malformed.
* @throws InvalidQueryException if the given query is invalid.
*/
@JvmStatic
fun withRequest(expectedJson: String): Parameters {
// check if the json and query is valid
expectedJson.toJSONObject().graphqlQueryDocument()
Expand Down

0 comments on commit 44f3bcf

Please sign in to comment.