-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#32: Add capability to write QuarkusIntegrationTests
While at it, reformat and unify code.
- Loading branch information
Showing
22 changed files
with
500 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ | |
import io.quarkiverse.cucumber.CucumberQuarkusTest; | ||
|
||
public class BasicTest extends CucumberQuarkusTest { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,8 @@ | |
|
||
@Path("/") | ||
public class Endpoint { | ||
|
||
@GET | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 14 additions & 20 deletions
34
integration-tests/src/main/java/io/quarkiverse/cucumber/it/CucumberResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.quarkiverse.cucumber.it; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/cucumber") | ||
@ApplicationScoped | ||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@Path(CucumberResource.PATH) | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public class CucumberResource { | ||
public static final String PATH = "cucumber"; | ||
|
||
private final String greeting; | ||
|
||
public CucumberResource(@ConfigProperty(name = "greeting") String greeting) { | ||
this.greeting = greeting; | ||
} | ||
|
||
@GET | ||
public String hello() { | ||
return "Hello cucumber"; | ||
return greeting; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
testPath=/cucumber | ||
greeting="Hello, cucumber!" |
9 changes: 9 additions & 0 deletions
9
integration-tests/src/test/java/io/quarkiverse/cucumber/it/CucumberResourceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.quarkiverse.cucumber.it; | ||
|
||
import io.quarkiverse.cucumber.CucumberQuarkusIntegrationTest; | ||
|
||
public class CucumberResourceIT extends CucumberQuarkusIntegrationTest { | ||
public static void main(String... args) { | ||
runMain(CucumberResourceIT.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
integration-tests/src/test/java/io/quarkiverse/cucumber/it/Steps.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
integration-tests/src/test/java/io/quarkiverse/cucumber/it/actors/CucumberResourceActor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.quarkiverse.cucumber.it.actors; | ||
|
||
import static io.restassured.RestAssured.when; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
import io.quarkiverse.cucumber.it.CucumberResource; | ||
import io.restassured.response.ValidatableResponse; | ||
|
||
@ApplicationScoped | ||
public class CucumberResourceActor { | ||
private final String greeting; | ||
|
||
@Inject | ||
public CucumberResourceActor(@ConfigProperty(name = "greeting") String greeting) { | ||
this.greeting = greeting; | ||
} | ||
|
||
private ValidatableResponse response; | ||
|
||
public void callTarget() { | ||
response = when().get(CucumberResource.PATH) | ||
.then(); | ||
} | ||
|
||
public void verifyResponse(int code) { | ||
try { | ||
response.statusCode(code) | ||
.contentType(MediaType.TEXT_PLAIN) | ||
.body(is(greeting)); | ||
} finally { | ||
resetState(); | ||
} | ||
} | ||
|
||
private void resetState() { | ||
response = null; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
integration-tests/src/test/java/io/quarkiverse/cucumber/it/options/CucumberOptionsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkiverse.cucumber.it.options; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkiverse.cucumber.CucumberOptions; | ||
import io.quarkiverse.cucumber.CucumberQuarkusIntegrationTest; | ||
import io.quarkiverse.cucumber.it.CucumberResourceIT; | ||
|
||
@CucumberOptions(glue = { "io.quarkiverse.cucumber.it.steps" }, tags = "@important", plugin = { "json" }) | ||
@ApplicationScoped | ||
public class CucumberOptionsIT extends CucumberQuarkusIntegrationTest { | ||
public static void main(String... args) { | ||
runMain(CucumberOptionsIT.class, args); | ||
} | ||
|
||
@Override | ||
protected Package[] packagesToScanRecursively() { | ||
return new Package[] { CucumberResourceIT.class.getPackage() }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.