|
1 | 1 | package org.javaee7.servlet.resource.packaging; |
2 | 2 |
|
3 | | -import static org.hamcrest.CoreMatchers.equalTo; |
4 | | -import static org.hamcrest.CoreMatchers.is; |
5 | | -import static org.hamcrest.CoreMatchers.startsWith; |
6 | | -import static org.junit.Assert.assertThat; |
| 3 | +import static org.junit.Assert.assertEquals; |
| 4 | +import static org.junit.Assert.assertTrue; |
7 | 5 |
|
8 | 6 | import java.io.File; |
9 | 7 | import java.net.MalformedURLException; |
10 | | -import java.net.URI; |
11 | 8 | import java.net.URISyntaxException; |
12 | 9 | import java.net.URL; |
| 10 | +import java.util.logging.Logger; |
13 | 11 |
|
14 | | -import javax.ws.rs.client.Client; |
15 | 12 | import javax.ws.rs.client.ClientBuilder; |
16 | | -import javax.ws.rs.client.WebTarget; |
17 | 13 | import javax.ws.rs.core.Response; |
18 | 14 |
|
19 | 15 | import org.jboss.arquillian.container.test.api.Deployment; |
| 16 | +import org.jboss.arquillian.container.test.api.RunAsClient; |
20 | 17 | import org.jboss.arquillian.junit.Arquillian; |
21 | 18 | import org.jboss.arquillian.test.api.ArquillianResource; |
22 | 19 | import org.jboss.shrinkwrap.api.ShrinkWrap; |
|
29 | 26 | */ |
30 | 27 | @RunWith(Arquillian.class) |
31 | 28 | public class ResourcePackagingTest { |
| 29 | + |
| 30 | + Logger logger = Logger.getLogger(ResourcePackagingTest.class.getName()); |
32 | 31 |
|
33 | 32 | @Deployment(testable = false) |
34 | 33 | public static WebArchive deploy() throws URISyntaxException { |
35 | 34 | return ShrinkWrap.create(WebArchive.class) |
36 | | - .addAsLibrary(new File("src/main/webapp/WEB-INF/lib/myResources.jar"), "myResources.jar"); |
| 35 | + .addAsLibrary(new File("src/main/webapp/WEB-INF/lib/myResources.jar"), "myResources.jar"); |
37 | 36 | } |
38 | 37 |
|
39 | 38 | @ArquillianResource |
40 | 39 | private URL base; |
41 | 40 |
|
42 | 41 | @Test |
43 | | - public void getMyResourceJarStyles() throws MalformedURLException { |
44 | | - Client client = ClientBuilder.newClient(); |
45 | | - WebTarget target = client.target(URI.create(new URL(base, "styles.css").toExternalForm())); |
46 | | - Response response = target.request().get(); |
47 | | - |
48 | | - assertThat(response.getStatus(), is(equalTo(200))); |
| 42 | + @RunAsClient |
| 43 | + public void getMyResourceJarStyles() throws MalformedURLException, URISyntaxException { |
| 44 | + Response response = |
| 45 | + ClientBuilder.newClient() |
| 46 | + .target(new URL(base, "styles.css").toURI()) |
| 47 | + .request() |
| 48 | + .get(); |
| 49 | + |
| 50 | + assertEquals(200, response.getStatus()); |
49 | 51 |
|
50 | 52 | String style = response.readEntity(String.class); |
51 | | - assertThat(style, startsWith("body {")); |
| 53 | + |
| 54 | + assertTrue(style.startsWith("body {")); |
52 | 55 | } |
53 | 56 |
|
54 | 57 | } |
0 commit comments