-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd40afe
commit c61c7a0
Showing
12 changed files
with
187 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<!--modelVersion / --> | ||
<modelVersion>4.0.0</modelVersion> | ||
<!--parent / --> | ||
<parent> | ||
<groupId>com.github.nhojpatrick.cucumber</groupId> | ||
<artifactId>nhojpatrick-cucumber</artifactId> | ||
<version>1.0.2-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
<!--groupId / --> | ||
<!--artifactId / --> | ||
<artifactId>nhojpatrick-cucumber-http-response-glue</artifactId> | ||
<!--packaging / --> | ||
<!--name / --> | ||
<!--version / --> | ||
<!--description / --> | ||
<!--url / --> | ||
<!--prerequisites / --> | ||
<!--issueManagement / --> | ||
<!--ciManagement / --> | ||
<!--inceptionYear / --> | ||
<!--mailingLists / --> | ||
<!--developers / --> | ||
<!--contributors / --> | ||
<!--licenses / --> | ||
<!--scm / --> | ||
<!--organization / --> | ||
<!--build / --> | ||
<!--profiles / --> | ||
<!--modules / --> | ||
<!--repositories / --> | ||
<!--pluginRepositories / --> | ||
<!--dependencies / --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.nhojpatrick.cucumber</groupId> | ||
<artifactId>nhojpatrick-cucumber-http-constants</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.nhojpatrick.cucumber</groupId> | ||
<artifactId>nhojpatrick-cucumber-http-response</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.nhojpatrick.cucumber</groupId> | ||
<artifactId>nhojpatrick-cucumber-state</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.nhojpatrick.hamcrest</groupId> | ||
<artifactId>nhojpatrick-hamcrest-lang</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j2-impl</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<!--reports (Deprecated) / --> | ||
<!--reporting / --> | ||
<!--dependencyManagement / --> | ||
<!--distributionManagement / --> | ||
<!--properties / --> | ||
<properties> | ||
<project.Automatic-Module-Name>com.github.nhojpatrick.cucumber.http.response.glue</project.Automatic-Module-Name> | ||
</properties> | ||
</project> |
46 changes: 46 additions & 0 deletions
46
.../src/main/java/com/github/nhojpatrick/cucumber/http/response/steps/HttpResponseSteps.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,46 @@ | ||
package com.github.nhojpatrick.cucumber.http.response.steps; | ||
|
||
import com.github.nhojpatrick.cucumber.core.exceptions.IllegalKeyException; | ||
import com.github.nhojpatrick.cucumber.core.exceptions.IllegalTypeClassException; | ||
import com.github.nhojpatrick.cucumber.core.exceptions.TypeMismatchException; | ||
import com.github.nhojpatrick.cucumber.http.core.model.HttpResponse; | ||
import com.github.nhojpatrick.cucumber.state.RunState; | ||
import com.github.nhojpatrick.cucumber.state.exceptions.NullRunStateException; | ||
import com.github.nhojpatrick.cucumber.state.validation.RunStateValidatorFactory; | ||
import com.google.inject.Inject; | ||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import io.cucumber.java.en.Given; | ||
|
||
import static com.github.nhojpatrick.cucumber.http.constants.HttpConstants.HTTP_RESPONSE_BODY; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.core.Is.is; | ||
import static org.hamcrest.core.IsEqual.equalTo; | ||
|
||
public class HttpResponseSteps { | ||
|
||
@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "Accepted will look at changing") | ||
private final RunState runState; | ||
|
||
@Inject | ||
public HttpResponseSteps(final RunState runState) { | ||
this.runState = runState; | ||
} | ||
|
||
@Given("http response status code of {int}") | ||
public void httpResponseStatusCode(final int expectedStatusCode) | ||
throws IllegalKeyException, | ||
IllegalTypeClassException, | ||
NullRunStateException, | ||
TypeMismatchException { | ||
|
||
RunStateValidatorFactory.getInstance() | ||
.withValue(HTTP_RESPONSE_BODY) | ||
.verify(this.runState); | ||
|
||
final HttpResponse httpResponse = this.runState.get(HTTP_RESPONSE_BODY, HttpResponse.class); | ||
final int actualStatusCode = httpResponse.getStatusCode(); | ||
|
||
assertThat("Unexpected http status code", actualStatusCode, is(equalTo(expectedStatusCode))); | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
...e/src/main/java11/com/github/nhojpatrick/cucumber/http/response/steps/ModuleInfoHack.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,4 @@ | ||
package com.github.nhojpatrick.cucumber.http.response.steps; | ||
|
||
public class ModuleInfoHack { | ||
} |
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,10 @@ | ||
module com.github.nhojpatrick.cucumber.http.response.glue { | ||
requires com.github.nhojpatrick.cucumber.http.constants; | ||
requires com.google.guice; | ||
requires io.cucumber.java; | ||
requires org.hamcrest; | ||
requires org.junit.jupiter.api; | ||
requires org.slf4j; | ||
requires transitive com.github.nhojpatrick.cucumber.http.response; | ||
requires transitive com.github.nhojpatrick.cucumber.state; | ||
} |
Empty file.
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,7 @@ | ||
open module com.github.nhojpatrick.cucumber.http.response.glue.test { | ||
requires com.github.nhojpatrick.cucumber.http.response.glue; | ||
requires org.apache.logging.log4j; | ||
requires org.hamcrest; | ||
requires transitive org.junit.jupiter.api; | ||
requires transitive org.junit.jupiter.engine; | ||
} |
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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Configuration> | ||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<PatternLayout pattern="TestConsole %-5p %l %m%n"/> | ||
</Console> | ||
</Appenders> | ||
<Loggers> | ||
<Logger name="com.github.nhojpatrick.cucumber.http.response.steps" level="debug"> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Logger name="com.github.nhojpatrick" level="info"> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Root level="error"> | ||
<AppenderRef ref="Console"/> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
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