use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoTimeMapTests method testTimeMapResponseHasTimeMapLink.
/**
* Test the timemap response for a rel=timemap.
*/
default void testTimeMapResponseHasTimeMapLink() {
try (final Response res = target(getResourceLocation() + TIMEMAP_QUERY_ARG).request().get()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response");
assertTrue(getLinks(res).stream().anyMatch(l -> l.getRels().contains("timemap") && l.getUri().toString().equals(getResourceLocation() + TIMEMAP_QUERY_ARG)), "Check for a rel=timemap Link header");
}
}
use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project notifications-backend by RedHatInsights.
the class CrudTestHelpers method getAccessList.
public static Optional<List<InternalApplicationUserPermission>> getAccessList(Header identity, int expected) {
String responseBody = given().header(identity).when().get("internal/access").then().statusCode(expected).extract().asString();
if (familyOf(expected) == SUCCESSFUL) {
JsonArray json = new JsonArray(responseBody);
List<InternalApplicationUserPermission> accessList = json.stream().map(o -> {
JsonObject jsonObject = (JsonObject) o;
assertNotNull(jsonObject.getString("application_id"));
assertNotNull(jsonObject.getString("application_display_name"));
assertNotNull(jsonObject.getString("role"));
return jsonObject.mapTo(InternalApplicationUserPermission.class);
}).collect(Collectors.toList());
return Optional.of(accessList);
}
return Optional.empty();
}
Aggregations