public final class TestUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
buildJwt(String webid,
String secret)
Build a JWT Token.
|
static Predicate<Graph> |
checkEventGraph(String resource,
IRI agent,
IRI activity,
IRI ldpType)
Check an event graph for required properties.
|
static Predicate<Graph> |
checkEventGraph(String resource,
String agent,
IRI activity,
IRI ldpType)
Check an event graph for required properties.
|
static IOService |
getIOService()
Get the IO service.
|
static List<Link> |
getLinks(Response res)
Get the link headers from a response.
|
static String |
getResourceAsString(String path)
Get a resource as a string.
|
static Predicate<Link> |
hasConstrainedBy(IRI iri)
Test if the given ldp:constrainedBy link is present.
|
static Predicate<Link> |
hasType(IRI iri)
Test if the given type link is present.
|
static boolean |
isReallyLaterThan(Instant time)
Check that it is now really later than the provided instant.
|
static Instant |
meanwhile()
Add in a delay.
|
static Graph |
readEntityAsGraph(Object entity,
String baseURL,
RDFSyntax syntax)
Read an entity as an RDF Graph.
|
static <T> T |
readEntityAsJson(Object entity,
com.fasterxml.jackson.core.type.TypeReference<T> valueType)
Parse a JSON entity into the desired type.
|
static String |
readEntityAsString(Object entity)
Read an http entity as a string.
|
public static String buildJwt(String webid, String secret)
webid - the web IDsecret - the JWT secretpublic static IOService getIOService()
public static Graph readEntityAsGraph(Object entity, String baseURL, RDFSyntax syntax)
entity - the HTTP entitybaseURL - the base URLsyntax - the RDF syntaxpublic static String readEntityAsString(Object entity)
entity - the entitypublic static <T> T readEntityAsJson(Object entity, com.fasterxml.jackson.core.type.TypeReference<T> valueType)
T - the intended return typeentity - the entityvalueType - the type referencepublic static Predicate<Link> hasConstrainedBy(IRI iri)
iri - the IRIpublic static Predicate<Link> hasType(IRI iri)
iri - the IRIpublic static String getResourceAsString(String path)
path - the resource pathpublic static List<Link> getLinks(Response res)
res - the responsepublic static Predicate<Graph> checkEventGraph(String resource, IRI agent, IRI activity, IRI ldpType)
resource - the resource IRIagent - the agent IRIactivity - the activity IRIldpType - the LDP type of the resourcepublic static Predicate<Graph> checkEventGraph(String resource, String agent, IRI activity, IRI ldpType)
resource - the resource IRIagent - the agent IRIactivity - the activity IRIldpType - the LDP type of the resourcepublic static Instant meanwhile()
public static boolean isReallyLaterThan(Instant time)
time - an instant