@Test public void isResource() { final byte[] id = new byte[KnownURIsDictionary.ID_LENGTH]; RANDOMIZER.nextBytes(id); assertFalse(_cut.isResource(null)); id[0] = KnownURIsDictionary.KNOWN_URI_MARKER + 1; _cut.isResource(id); verify(_decoratee).isResource(id); reset(_decoratee); id[1] = IDictionary.RESOURCE_BYTE_FLAG + 1; _cut.isResource(id); verify(_decoratee).isResource(id); reset(_decoratee); final byte[] tooShort = new byte[KnownURIsDictionary.ID_LENGTH - 1]; final byte[] tooLong = new byte[KnownURIsDictionary.ID_LENGTH + 1]; tooShort[0] = KnownURIsDictionary.KNOWN_URI_MARKER; tooLong[0] = KnownURIsDictionary.KNOWN_URI_MARKER; tooShort[1] = IDictionary.RESOURCE_BYTE_FLAG; tooLong[1] = IDictionary.RESOURCE_BYTE_FLAG; _cut.isResource(tooShort); verify(_decoratee).isResource(tooShort); reset(_decoratee); _cut.isResource(tooLong); verify(_decoratee).isResource(tooLong); reset(_decoratee); id[0] = KnownURIsDictionary.KNOWN_URI_MARKER; id[1] = IDictionary.RESOURCE_BYTE_FLAG; assertTrue(_cut.isResource(id)); verify(_decoratee, times(0)).isResource(id); }
@Override public boolean isResource(final byte[] id) { return id != null && ((id[0] == KNOWN_URI_MARKER && id[1] == RESOURCE_BYTE_FLAG && id.length == ID_LENGTH) || (_decoratee.isResource(id))); }
KnownURIsDictionary extends SingleIndexValueDictionary implements ManageableKnownURIsDictionary { @Override public boolean isResource(final byte[] id) { return id != null && ((id[0] == KNOWN_URI_MARKER && id[1] == RESOURCE_BYTE_FLAG && id.length == ID_LENGTH) || (_decoratee.isResource(id))); } }
KnownURIsDictionary extends SingleIndexValueDictionary implements ManageableKnownURIsDictionary { @Override public boolean isResource(final byte[] id) { return id != null && ((id[0] == KNOWN_URI_MARKER && id[1] == RESOURCE_BYTE_FLAG && id.length == ID_LENGTH) || (_decoratee.isResource(id))); } KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee);  KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee, final String ... domains); }
KnownURIsDictionary extends SingleIndexValueDictionary implements ManageableKnownURIsDictionary { @Override public boolean isResource(final byte[] id) { return id != null && ((id[0] == KNOWN_URI_MARKER && id[1] == RESOURCE_BYTE_FLAG && id.length == ID_LENGTH) || (_decoratee.isResource(id))); } KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee);  KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee, final String ... domains); @Override void initialiseInternal(final DataAccessLayerFactory factory); @Override void removeValue(final Value value, final boolean p); @Override boolean isBNode(final byte[] id); @Override boolean isLiteral(final byte[] id); @Override boolean isResource(final byte[] id); @Override long getIdKnownURIsHitsCount(); @Override long getValueKnownURIsHitsCount(); }
KnownURIsDictionary extends SingleIndexValueDictionary implements ManageableKnownURIsDictionary { @Override public boolean isResource(final byte[] id) { return id != null && ((id[0] == KNOWN_URI_MARKER && id[1] == RESOURCE_BYTE_FLAG && id.length == ID_LENGTH) || (_decoratee.isResource(id))); } KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee);  KnownURIsDictionary(final String id, final ITopLevelDictionary decoratee, final String ... domains); @Override void initialiseInternal(final DataAccessLayerFactory factory); @Override void removeValue(final Value value, final boolean p); @Override boolean isBNode(final byte[] id); @Override boolean isLiteral(final byte[] id); @Override boolean isResource(final byte[] id); @Override long getIdKnownURIsHitsCount(); @Override long getValueKnownURIsHitsCount();  }