@Test
public void testShouldWorkWithRKFHashPrefixedLayout() throws Exception {
final TableLayoutDesc desc =
KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_RKF);
final KijiTableLayout layout = KijiTableLayout.newLayout(desc);
final EntityIdFactory factory = EntityIdFactory.getFactory(layout);
// Byte array representations of row keys should work.
// Prepend appropriate hashed prefix to UNUSUAL_STRING_EID.
final byte[] rowKey = Bytes.toBytes(UNUSUAL_STRING_EID);
final byte[] hash = Hasher.hash(Bytes.toBytes(UNUSUAL_STRING_EID));
final byte[] hbaseRowKey = new byte[rowKey.length + 2];
System.arraycopy(hash, 0, hbaseRowKey, 0, 2);
System.arraycopy(rowKey, 0, hbaseRowKey, 2, rowKey.length);
final EntityId originalEid = factory.getEntityIdFromHBaseRowKey(hbaseRowKey);
final JsonEntityIdParser restEid1 = JsonEntityIdParser.create(originalEid, layout);
final JsonEntityIdParser restEid2 = JsonEntityIdParser.create(
String.format("hbase=%s", Bytes.toStringBinary(hbaseRowKey)), layout);
final JsonEntityIdParser restEid3 = JsonEntityIdParser.create(
String.format("hbase_hex=%s", new String(Hex.encodeHex((hbaseRowKey)))), layout);