/** * Get the degree of a node by direction and types * * <p>If you are only interested in the degree of a particular relationship type, or a set of * relationship types, you specify relationship types after the direction. You can combine * multiple relationship types by using the `&` character. */ @Documented @Test @GraphDescription.Graph({"Root KNOWS Mattias", "Root KNOWS Johan", "Root LIKES Cookie"}) public void get_degree_by_direction_and_type() throws JsonParseException { Map<String, Node> nodes = data.get(); String nodeUri = getNodeUri(nodes.get("Root")); // Document RESTDocsGenerator.ResponseEntity response = gen.get().expectedStatus(200).get(nodeUri + "/degree/out/KNOWS&LIKES"); // Then assertEquals(3, JsonHelper.jsonNode(response.response().getEntity()).asInt()); }
/** * Get the degree of a node * * <p>Return the total number of relationships associated with a node. */ @Documented @Test @GraphDescription.Graph({"Root knows Mattias", "Root knows Johan"}) public void get_degree() throws JsonParseException { Map<String, Node> nodes = data.get(); String nodeUri = getNodeUri(nodes.get("Root")); // Document RESTDocsGenerator.ResponseEntity response = gen.get().expectedStatus(200).get(nodeUri + "/degree/all"); // Then assertEquals(2, JsonHelper.jsonNode(response.response().getEntity()).asInt()); }