assertArrayEquals(formattedEntityId.getHBaseRowKey(), testEntityId.getHBaseRowKey());
}
@Test
public void testFormattedEntityIdUsingFactory() {
final RowKeyFormat2 format = makeRowKeyFormat();
final EntityIdFactory entityIdFactory = EntityIdFactory.getFactory(format);
final List<Object> inputRowKey = Lists.<Object>newArrayList("one", 1, 7L);
// passing args as list
final EntityId formattedEntityId = entityIdFactory.getEntityId(inputRowKey);
final byte[] hbaseRowKey = formattedEntityId.getHBaseRowKey();
assertNotNull(hbaseRowKey);
LOG.info("Hbase Key is: {}", ByteArrayFormatter.toHex(hbaseRowKey, ':'));
EntityId testEntityId = entityIdFactory.getEntityIdFromHBaseRowKey(hbaseRowKey);
final List<Object> actuals = testEntityId.getComponents();
assertEquals(format.getComponents().size(), actuals.size());
assertEquals("one", actuals.get(0));
assertEquals(1, actuals.get(1));
assertEquals(7L, actuals.get(2));
assertArrayEquals(formattedEntityId.getHBaseRowKey(), testEntityId.getHBaseRowKey());
// passing args as varargs
EntityId formattedEntityId2 = entityIdFactory.getEntityId("two",
new Integer(2), new Long(72L));
byte[] hbaseRowKey2 = formattedEntityId2.getHBaseRowKey();
assertNotNull(hbaseRowKey2);
EntityId testEntityId2 = entityIdFactory.getEntityIdFromHBaseRowKey(hbaseRowKey2);
List<Object> actuals2 = testEntityId2.getComponents();
assertEquals(format.getComponents().size(), actuals2.size());
assertEquals("two", actuals2.get(0));
assertEquals(2, actuals2.get(1));
assertEquals(72L, actuals2.get(2));
assertArrayEquals(formattedEntityId2.getHBaseRowKey(), testEntityId2.getHBaseRowKey());