Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applying filter changed reference to RequestSpecification,
no need to decorate as we do nothing with the decorates RequestSpecification
- Loading branch information
1 parent
b96190a
commit 2095ed1
Showing
2 changed files
with
62 additions
and
19 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
32 changes: 32 additions & 0 deletions
32
...t/java/net/serenitybdd/screenplay/rest/examples/WhenUsingSessionFilterRegressionTest.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,32 @@ | ||
package net.serenitybdd.screenplay.rest.examples; | ||
|
||
import io.restassured.filter.session.SessionFilter; | ||
import net.serenitybdd.junit.runners.SerenityRunner; | ||
import net.serenitybdd.screenplay.Actor; | ||
import net.serenitybdd.screenplay.rest.abilities.CallAnApi; | ||
import net.serenitybdd.screenplay.rest.interactions.Get; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static net.serenitybdd.screenplay.rest.questions.ResponseConsequence.seeThatResponse; | ||
|
||
@RunWith(SerenityRunner.class) | ||
public class WhenUsingSessionFilterRegressionTest { | ||
|
||
Actor actor = Actor.named("actor").whoCan(CallAnApi.at("https://reqres.in")); | ||
|
||
@Test | ||
public void didThrowNPE() { | ||
actor.attemptsTo(Get.resource("/").with(request -> request.filter(new SessionFilter()))); | ||
actor.should(seeThatResponse("bad request", response -> response.statusCode(200))); | ||
|
||
} | ||
@Test | ||
public void didSucceed() { | ||
actor.attemptsTo(Get.resource("/").with(request -> { | ||
request.filter(new SessionFilter()); | ||
return request; | ||
})); | ||
actor.should(seeThatResponse("bad request", response -> response.statusCode(200))); | ||
} | ||
} |