package de.leanovate.cucumber.rest;

import org.apache.http.HttpResponse;
import org.assertj.core.api.AbstractAssert;

import static org.assertj.core.api.Assertions.assertThat;

public class HttpResponseAssert extends AbstractAssert<HttpResponseAssert, HttpResponse> {
    protected HttpResponseAssert(HttpResponse actual) {
        super(actual, HttpResponseAssert.class);
    }

    public HttpResponseAssert isNotFailure() {
        isNotNull();

        assertThat(actual.getStatusLine().getStatusCode()).isGreaterThanOrEqualTo(200).isLessThan(300);

        return myself;
    }

    public HttpResponseAssert hasStatus(int status) {
        isNotNull();

        assertThat(actual.getStatusLine().getStatusCode()).isEqualTo(status);

        return myself;
    }

    public HttpResponseAssert isOk() {
        return hasStatus(200);
    }

    public HttpResponseAssert isCreated() {
        return hasStatus(201);
    }

    public HttpResponseAssert isNoContent() {
        return hasStatus(204);
    }
}

@@ -570,32 +570,237 @@
  myself;%0A    %7D%0A%0A
+    public HttpResponseAssert isClientError() %7B%0A        isNotNull();%0A%0A        assertThat(actual.getStatusLine().getStatusCode()).isGreaterThanOrEqualTo(400).isLessThan(500);%0A%0A        return myself;%0A    %7D%0A%0A
     public HttpR
@@ -1209,11 +1209,179 @@
 );%0A    %7D
+%0A%0A    public HttpResponseAssert isBadRequest() %7B%0A        return hasStatus(400);%0A    %7D%0A%0A    public HttpResponseAssert isNotFound() %7B%0A        return hasStatus(404);%0A    %7D
 %0A%7D%0A

Add assertions