@Override public Set<String> getAllowedMethods() { return delegate.getAllowedMethods(); }
@Override public Set<String> getAllowedMethods() { return rawResponse.getAllowedMethods(); }
public Set<String> getAllowedMethods() { return r.getAllowedMethods(); }
/** * Check a response for expected Allow header values. * @param res the Response object * @return a Stream of executable assertions */ default Stream<Executable> checkMementoAllowedMethods(final Response res) { return of( () -> assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response"), () -> assertTrue(res.getAllowedMethods().contains("GET"), "GET should be allowed!"), () -> assertTrue(res.getAllowedMethods().contains("HEAD"), "HEAD should be allowed!"), () -> assertTrue(res.getAllowedMethods().contains("OPTIONS"), "OPTIONS should be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("POST"), "POST shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("PUT"), "PUT shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("PATCH"), "PATCH shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("DELETE"), "DELETE shouldn't be allowed!")); }
/** * Check a response for expected Allow header values. * @param res the Response object * @return a Stream of executable assertions */ default Stream<Executable> checkMementoAllowedMethods(final Response res) { return of( () -> assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response"), () -> assertTrue(res.getAllowedMethods().contains("GET"), "GET should be allowed!"), () -> assertTrue(res.getAllowedMethods().contains("HEAD"), "HEAD should be allowed!"), () -> assertTrue(res.getAllowedMethods().contains("OPTIONS"), "OPTIONS should be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("POST"), "POST shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("PUT"), "PUT shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("PATCH"), "PATCH shouldn't be allowed!"), () -> assertFalse(res.getAllowedMethods().contains("DELETE"), "DELETE shouldn't be allowed!")); }
private Stream<Executable> checkAllowedMethods(final Response res, final List<String> expected) { final Set<String> actual = res.getAllowedMethods(); return Stream.concat( actual.stream().map(method -> () -> assertTrue(expected.contains(method), "Method " + method + " was not present in the list of expected methods!")), expected.stream().map(method -> () -> assertTrue(actual.contains(method), "Method " + method + " was not in the response header!"))); } }