Created
November 23, 2012 12:09
-
-
Save lfryc/4135342 to your computer and use it in GitHub Desktop.
Warp.given(Conditions).when(Activity).then(Inspect);
This file contains hidden or 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
| @Test | |
| public void testAjaxGetStock() { | |
| browser.navigate().to(contextUrl + "restclient.jsp"); | |
| Warp | |
| .given(request().endsWith("/stocks")) | |
| .when(new Activity() { | |
| public void perform() { | |
| browser.findElement(By.className("stockLink")).click(); | |
| } | |
| }) | |
| .then(new Inspect() { | |
| @ArquillianResource | |
| private RestContext restContext; | |
| @AfterServlet | |
| public void testGetStock() { | |
| assertThat(restContext.getRequest().getMethod()).isEqualTo(HttpMethod.GET); | |
| assertThat(restContext.getResponse().getStatusCode()).isEqualTo(Response.Status.OK.getStatusCode()); | |
| assertThat(restContext.getResponse().getContentType()).isEqualTo("application/json"); | |
| Stock stock = (Stock) restContext.getResponse().getEntity(); | |
| assertThat(stock.getId()).isEqualTo(1L); | |
| assertThat(stock.getName()).isEqualTo("Acme"); | |
| assertThat(stock.getCode()).isEqualTo("ACM"); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment