diff --git a/pom.xml b/pom.xml
index a52db1fc3bf7b9094e3b9360f4a345c46efb9e6b..57fc0f518dae19a2f3af7d07b3d6e6de64fde39d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
es.uvigo.esei.daa
example
war
- 0.1.8
+ 0.1.9
DAA Example
diff --git a/src/test/java/es/uvigo/esei/daa/matchers/HasHttpStatus.java b/src/test/java/es/uvigo/esei/daa/matchers/HasHttpStatus.java
index e5e7111741c59ff73893ff6c01cb5ba323ad3bdb..8da8cb196f99243c5dbf04e183fb232ad475f2be 100644
--- a/src/test/java/es/uvigo/esei/daa/matchers/HasHttpStatus.java
+++ b/src/test/java/es/uvigo/esei/daa/matchers/HasHttpStatus.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
@@ -34,11 +34,11 @@ import org.hamcrest.TypeSafeMatcher;
public class HasHttpStatus extends TypeSafeMatcher {
private final StatusType expectedStatus;
-
+
public HasHttpStatus(StatusType expectedStatus) {
this.expectedStatus = requireNonNull(expectedStatus);
}
-
+
public HasHttpStatus(int expectedStatus) {
this(Status.fromStatusCode(expectedStatus));
}
@@ -48,41 +48,46 @@ public class HasHttpStatus extends TypeSafeMatcher {
description.appendValue(this.expectedStatus);
}
+ @Override
+ protected void describeMismatchSafely(Response item, Description mismatchDescription) {
+ mismatchDescription.appendText("was ").appendValue(item.getStatusInfo());
+ }
+
@Override
protected boolean matchesSafely(Response item) {
return item != null && expectedStatus.getStatusCode() == item.getStatusInfo().getStatusCode();
}
-
+
@Factory
public static Matcher hasHttpStatus(StatusType expectedStatus) {
return new HasHttpStatus(expectedStatus);
}
-
+
@Factory
public static Matcher hasHttpStatus(int expectedStatus) {
return new HasHttpStatus(expectedStatus);
}
-
+
@Factory
public static Matcher hasOkStatus() {
return new HasHttpStatus(Response.Status.OK);
}
-
+
@Factory
public static Matcher hasBadRequestStatus() {
return new HasHttpStatus(Response.Status.BAD_REQUEST);
}
-
+
@Factory
public static Matcher hasInternalServerErrorStatus() {
return new HasHttpStatus(Response.Status.INTERNAL_SERVER_ERROR);
}
-
+
@Factory
public static Matcher hasUnauthorized() {
return new HasHttpStatus(Response.Status.UNAUTHORIZED);
}
-
+
@Factory
public static Matcher hasForbidden() {
return new HasHttpStatus(Response.Status.FORBIDDEN);