Created
October 22, 2012 19:47
-
-
Save lfryc/3933633 to your computer and use it in GitHub Desktop.
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
public class TestExecutionAPI { | |
/** | |
* Single client action paired with single server assertion for most simplest | |
* cases | |
*/ | |
@Test | |
public void testSimpleExecution() { | |
Warp.execute(clientAction) | |
.verify(serverAssertion); | |
} | |
/** | |
* Single client action and server assertion applied for request matching | |
* given filter | |
*/ | |
@Test | |
public void testSimpleFiltering() { | |
Warp.execute(clientAction) | |
.filter(requestFilter) | |
.verify(serverAssertion); | |
} | |
/** | |
* The result of simplest possible execution is ServerAssertion (modified | |
* on the server) | |
*/ | |
@Test | |
public void testSimpleResult() { | |
ServerAssertion assertion = Warp.execute(clientAction) | |
.verify(serverAssertion); | |
} | |
/** | |
* Two requests caused by single client action are verified concurrently. | |
*/ | |
@Test | |
public void testGroupOfTwoRequests() { | |
Warp.execute(clientAction) | |
.group(1) | |
.filter(requestFilter) | |
.verify(serverAssertion) | |
.group(2) | |
.filter(requestFilter) | |
.verify(serverAssertion) | |
.verifyAll(); | |
} | |
/** | |
* Complex Warp executions stores their results inside {@link WarpResult} | |
* object where result of assertion and other details (e.g. filter hit | |
* count) is stored. | |
*/ | |
@Test | |
public void testResultOfComplexGroupExecution() { | |
WarpResult result = Warp.execute(clientAction) | |
.group("first") | |
.filter(requestFilter) | |
.verify(serverAssertion) | |
.group("second") | |
.filter(requestFilter) | |
.verify(serverAssertion) | |
.verifyAll(); | |
ServerAssertion firstAssertion = result.getGroup("first").getAssertion(); | |
int hitCount = result.getGroup("second").getHitCount(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment