Last active
December 21, 2015 14:08
-
-
Save wombat/6317015 to your computer and use it in GitHub Desktop.
JAX-RS 2.0 Client + Arquillian = Dream Team
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
@RunWith(Arquillian.class) | |
public class FoodResourceTest { | |
@Deployment | |
public static WebArchive createDeployment() { | |
return ShrinkWrap.create(WebArchive.class, "test.war") | |
.addPackages(true, "eu.jugcologne.foodeys") | |
.addClass(RestApplication.class) | |
.addAsResource("test-persistence.xml", "META-INF/persistence.xml") | |
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | |
} | |
@Test | |
@RunAsClient | |
public void testAutocompleteWithoutQuery(@ArquillianResource URL base) throws Exception { | |
Client client = ClientBuilder.newClient(); | |
WebTarget target = client.target(base.toURI() + RestApplication.REST_PATH + "/food/autocomplete/"); | |
Response response = target.request().get(); | |
Assert.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus()); | |
} | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>foodeys-rest-impl</artifactId> | |
... | |
<dependencies> | |
... | |
<dependency> | |
<groupId>org.jboss.resteasy</groupId> | |
<artifactId>resteasy-client</artifactId> | |
<version>3.0.2.Final</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment