Skip to content

Instantly share code, notes, and snippets.

@lfryc
Created October 22, 2012 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfryc/3933633 to your computer and use it in GitHub Desktop.
Save lfryc/3933633 to your computer and use it in GitHub Desktop.
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