You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question regarding then(), which is implemented with a single method signature in TestState.java as follows:
public <ItemOfInterest> TestState then(StateExtractor<ItemOfInterest> extractor, Matcher<? super ItemOfInterest> matcher) throws Exception {
assertThat(extractor.execute(capturedInputAndOutputs), matcher);
return this;
}
As I understand, in order to use then(), I have to supply a StateExtractor typed first argument, which makes sense in a simple scenario where I want to get a piece of state from the application and then do a straightforward assertion on it e.g.
then(theLoginLinkDisplay(), is(false))
However in the tests I'm writing, I find that I want to do quite a few assertions and I don't necessarily want to pass them all declaratively in the test narrative either, I just want to do all them all 'under the hood' and report back any match failures. e.g.
In the above, isSuccessfulAndAllDetailsOfMyAccountIsDisplayed() is a self contained matcher which has access to multiple bits of application state and doesn't even refer to the state returned by theLogin() which is only reallly there to satisfy the method signature.
So what it seems that what I need is a then() that takes just a single matcher argument that does all of the end-point assertion work. Is this a crazy Idea and/or am I missing the point here?
Thanks in advance,
Nick
The text was updated successfully, but these errors were encountered:
Hi again yatspeccers,
I have a question regarding then(), which is implemented with a single method signature in TestState.java as follows:
As I understand, in order to use then(), I have to supply a StateExtractor typed first argument, which makes sense in a simple scenario where I want to get a piece of state from the application and then do a straightforward assertion on it e.g.
then(theLoginLinkDisplay(), is(false))
However in the tests I'm writing, I find that I want to do quite a few assertions and I don't necessarily want to pass them all declaratively in the test narrative either, I just want to do all them all 'under the hood' and report back any match failures. e.g.
then(theLogin(), isSuccessfulAndAllDetailsOfMyAccountIsDisplayed());
In the above, isSuccessfulAndAllDetailsOfMyAccountIsDisplayed() is a self contained matcher which has access to multiple bits of application state and doesn't even refer to the state returned by theLogin() which is only reallly there to satisfy the method signature.
So what it seems that what I need is a then() that takes just a single matcher argument that does all of the end-point assertion work. Is this a crazy Idea and/or am I missing the point here?
Thanks in advance,
Nick
The text was updated successfully, but these errors were encountered: