Custom Matchers, Better Messages: JAX-RS Client Rulz v0.0.4 released

The v0.0.4 release of the JUnit JAX-RS Rules 13kB JAR comes with additional matchers: clientError(), redirection(), informational() and other(), as well as, improved matcher messages, like e.g.


Expected: is 2xx family of successful responses
but: Internal Server Error 500 returned

Installation:


<dependency>
	<groupId>com.airhacks.rulz</groupId>
	<artifactId>jaxrsclient</artifactId>
	<version>v0.0.4</version>
	<scope>test</scope>
</dependency>

Sample usage:


import static com.airhacks.rulz.jaxrsclient.HttpMatchers.successful;

public class JAXRSClientProviderTest {

    @Rule
    public JAXRSClientProvider provider = JAXRSClientProvider.buildWithURI("http://adambien.blog");

    @Test
    public void pingJavaAndVerifyWithMatcher() {

        Response response = (...)
        assertThat(response, is(successful()));
    }


Meet rulz at Java EE 7 Testing and Code Quality workshop at MUC airport.

Junit rules are also explained in the episode "JAX-RS Rules For JUnit" of the online Effective Java EE 7 workshop and episodes "AOP For JUnit - Writing Custom Rules" and "JAX-RS Test Rules" of the online version of Java EE Testing workshop.


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