@Test void testRequirePreconditions() { assertDoesNotThrow(() -> HttpUtils.checkRequiredPreconditions(true, "*", null)); assertDoesNotThrow(() -> HttpUtils.checkRequiredPreconditions(true, null, "Mon, 17 Dec 2018 07:28:00 GMT")); assertDoesNotThrow(() -> HttpUtils.checkRequiredPreconditions(false, null, null)); try (final Response res = assertThrows(ClientErrorException.class, () -> HttpUtils.checkRequiredPreconditions(true, null, null)).getResponse()) { assertEquals(PRECONDITION_REQUIRED, res.getStatus()); } }
public static void checkRequiredPreconditions(final boolean required, final String ifMatch, final String ifUnmodifiedSince) { if (required && ifMatch == null && ifUnmodifiedSince == null) { throw new ClientErrorException(status(PRECONDITION_REQUIRED).build()); } }
HttpUtils { public static void checkRequiredPreconditions(final boolean required, final String ifMatch, final String ifUnmodifiedSince) { if (required && ifMatch == null && ifUnmodifiedSince == null) { throw new ClientErrorException(status(PRECONDITION_REQUIRED).build()); } } }
HttpUtils { public static void checkRequiredPreconditions(final boolean required, final String ifMatch, final String ifUnmodifiedSince) { if (required && ifMatch == null && ifUnmodifiedSince == null) { throw new ClientErrorException(status(PRECONDITION_REQUIRED).build()); } } private  HttpUtils(); }
HttpUtils { public static void checkRequiredPreconditions(final boolean required, final String ifMatch, final String ifUnmodifiedSince) { if (required && ifMatch == null && ifUnmodifiedSince == null) { throw new ClientErrorException(status(PRECONDITION_REQUIRED).build()); } } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl); }
HttpUtils { public static void checkRequiredPreconditions(final boolean required, final String ifMatch, final String ifUnmodifiedSince) { if (required && ifMatch == null && ifUnmodifiedSince == null) { throw new ClientErrorException(status(PRECONDITION_REQUIRED).build()); } } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl);  }