public class AlexaResponse extends Object
| Constructor and Description |
|---|
AlexaResponse(AlexaRequest request,
String requestPayload,
String responsePayload) |
| Modifier and Type | Method and Description |
|---|---|
AlexaResponse |
assertContains(String jsonPathExpression,
String s) |
AlexaResponse |
assertEquals(String jsonPathExpression,
Object o) |
AlexaResponse |
assertExecutionTimeLessThan(long millis)
Validates the execution time of the request call to the skill.
|
AlexaResponse |
assertExists(String jsonPathExpression) |
AlexaResponse |
assertFalse(String jsonPathExpression) |
AlexaResponse |
assertNotExists(String jsonPathExpression) |
AlexaResponse |
assertThat(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope)
Validates a custom predicate executed against the response envelope.
|
AlexaResponse |
assertThat(String jsonPathExpression)
Validates a custom json-path expression
throws an IllegalArgumentException in the expression does not return an element
|
AlexaResponse |
assertTrue(String jsonPathExpression) |
boolean |
contains(String jsonPathExpression,
String s) |
AlexaSession |
done()
exits the fluent interface and returns the actor in order to continue with
next skill request.
|
boolean |
equals(String jsonPathExpression,
Object o) |
boolean |
exists(String jsonPathExpression) |
Optional<String> |
get(String jsonPath) |
AlexaRequest |
getRequest() |
com.amazon.speech.json.SpeechletResponseEnvelope |
getResponseEnvelope() |
AlexaResponse |
ifContains(String jsonPathExpression,
String s,
Consumer<AlexaSession> followUp) |
AlexaResponse |
ifEquals(String jsonPathExpression,
Object o,
Consumer<AlexaSession> followUp) |
AlexaResponse |
ifExists(String jsonPathExpression,
Consumer<AlexaSession> followUp) |
AlexaResponse |
ifFalse(String jsonPathExpression,
Consumer<AlexaSession> followUp) |
AlexaResponse |
ifIs(String jsonPathExpression,
Consumer<AlexaSession> followUp)
Validates a custom predicate executed against the response envelope.
|
AlexaResponse |
ifNotExists(String jsonPathExpression,
Consumer<AlexaSession> followUp) |
AlexaResponse |
ifTrue(String jsonPathExpression,
Consumer<AlexaSession> followUp) |
boolean |
is(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope)
Validates a custom predicate executed against the response envelope.
|
AlexaResponse |
is(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope,
Consumer<AlexaSession> followUp)
Validates a custom predicate executed against the response envelope.
|
boolean |
is(String jsonPathExpression)
Validates a custom json-path expression
|
boolean |
isEmpty()
An AlexaResponse is empty for requests that do not get a response from the skill
e.g.
|
boolean |
isFalse(String jsonPathExpression) |
boolean |
isTrue(String jsonPathExpression) |
boolean |
notExists(String jsonPathExpression) |
public AlexaResponse(AlexaRequest request, String requestPayload, String responsePayload)
public com.amazon.speech.json.SpeechletResponseEnvelope getResponseEnvelope()
public AlexaRequest getRequest()
public boolean isEmpty()
public AlexaResponse assertExecutionTimeLessThan(long millis)
millis - milliseconds (inclusive) that should not be exceeded by the skill callpublic AlexaResponse assertThat(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope)
responseEnvelope - the response envelope of the requestpublic AlexaResponse assertThat(String jsonPathExpression)
jsonPathExpression - a json-path expressionpublic AlexaResponse assertTrue(String jsonPathExpression)
public AlexaResponse assertFalse(String jsonPathExpression)
public AlexaResponse assertExists(String jsonPathExpression)
public AlexaResponse assertNotExists(String jsonPathExpression)
public AlexaResponse assertEquals(String jsonPathExpression, Object o)
public AlexaResponse assertContains(String jsonPathExpression, String s)
public boolean is(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope)
responseEnvelope - the response envelope of the requestpublic boolean is(String jsonPathExpression)
jsonPathExpression - a json-path expressionpublic AlexaResponse is(Predicate<com.amazon.speech.json.SpeechletResponseEnvelope> responseEnvelope, Consumer<AlexaSession> followUp)
responseEnvelope - the response envelope of the requestfollowUp - code-block executes when condition is truepublic AlexaResponse ifIs(String jsonPathExpression, Consumer<AlexaSession> followUp)
jsonPathExpression - the response envelope of the requestfollowUp - code-block executes when condition is truepublic boolean isTrue(String jsonPathExpression)
public boolean isFalse(String jsonPathExpression)
public boolean exists(String jsonPathExpression)
public boolean notExists(String jsonPathExpression)
public AlexaResponse ifTrue(String jsonPathExpression, Consumer<AlexaSession> followUp)
public AlexaResponse ifFalse(String jsonPathExpression, Consumer<AlexaSession> followUp)
public AlexaResponse ifExists(String jsonPathExpression, Consumer<AlexaSession> followUp)
public AlexaResponse ifNotExists(String jsonPathExpression, Consumer<AlexaSession> followUp)
public AlexaResponse ifEquals(String jsonPathExpression, Object o, Consumer<AlexaSession> followUp)
public AlexaResponse ifContains(String jsonPathExpression, String s, Consumer<AlexaSession> followUp)
public AlexaSession done()
Copyright © 2018. All rights reserved.