PersistentValueDictionary extends ValueDictionaryBase { @Override public boolean isLiteral(final byte[] id) { return id != null && id.length == ID_LENGTH && id[0] == LITERAL_BYTE_FLAG; } PersistentValueDictionary(final String id); @Override void initialiseInternal(final DataAccessLayerFactory factory); @Override void closeInternal(); @Override void removeValue(final Value value, final boolean p); @Override byte[][] decompose(final byte[] compositeId); @Override byte[] compose(final byte[] id1, final byte [] id2); @Override byte[] compose(final byte[] id1, final byte [] id2, final byte[] id3); @Override boolean isBNode(final byte[] id); @Override boolean isLiteral(final byte[] id); @Override boolean isResource(final byte[] id);  }
@Test public void isLiteral() { byte[] id = new byte[PersistentValueDictionary.ID_LENGTH]; RANDOMIZER.nextBytes(id); assertFalse(_cut.isBNode(null)); assertFalse("Wrong id length.", _cut.isLiteral(new byte[RANDOMIZER.nextInt(PersistentValueDictionary.ID_LENGTH)])); assertFalse("Wrong id length.", _cut.isLiteral(new byte[(RANDOMIZER.nextInt(PersistentValueDictionary.ID_LENGTH) + 1) * 100])); id[0] = IDictionary.RESOURCE_BYTE_FLAG; assertFalse(_cut.isLiteral(id)); id[0] = IDictionary.BNODE_BYTE_FLAG; assertFalse(_cut.isLiteral(id)); id[0] = IDictionary.LITERAL_BYTE_FLAG; assertTrue(_cut.isLiteral(id)); }