001package org.w3.ldp.testsuite.matcher; 002 003import org.hamcrest.Description; 004import org.hamcrest.Factory; 005import org.hamcrest.Matcher; 006import org.hamcrest.TypeSafeMatcher; 007 008public class HttpStatus4xxRangeMatcher extends TypeSafeMatcher<Integer> { 009 010 @Override 011 public void describeTo(Description d) { 012 d.appendText("in the 4xx range"); 013 } 014 015 @Override 016 protected boolean matchesSafely(Integer status) { 017 return status >= 400 && status <= 499; 018 } 019 020 @Factory 021 public static Matcher<Integer> is4xxRange() { 022 return new HttpStatus4xxRangeMatcher(); 023 } 024}