Rulz: JAX-RS 2.0 Client Provider for System Tests Released

JUnit Rule for convenient initialization of JAX-RS 2.0 Client in system tests released (github.com/AdamBien/rulz):


public class JAXRSClientProviderTest {
	
    @Rule
    public JAXRSClientProvider provider = JAXRSClientProvider.buildWithURI("http://www.java.com");
	
    @Test
    public void pingJava() {
        Client client = provider.client();
        assertNotNull(client);
        WebTarget target = provider.target();
        assertNotNull(target);
        Response response = target.request(MediaType.TEXT_HTML).get();
        assertThat(response.getStatus(), is(200));
    }

}

The required test dependency can be easily declared with Maven:

<dependency>
    <groupId>com.airhacks.rulz</groupId>
    <artifactId>jaxrsclient</artifactId>
    <version>[RECENT_VERSION]</version>
    <scope>test</scope>
</dependency>

See also the EntityManager provider rule.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW online workshop: WebStandards Igniter (online)

Airport MUC workshops: Java EE 8, Java 9: Bootstrap, Effective, Architectures, Single Page Apps, Progressive Web Apps, HTML 5, ES 6, CSS 3 and Microservices

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License