MutationFactory { public List<Delete> delete(long tableId, final Row row) { List<Delete> deletes = deleteIndices(tableId, row); deletes.add(new Delete(new DataRowKey(tableId, row.getUUID()).encode())); return deletes; } @Inject  MutationFactory(HBaseStore store); @Inject void setColumnFamily(final @Named(ConfigConstants.COLUMN_FAMILY) String columnFamily); List<Put> insert(long tableId, final Row row); List<Put> insert(long tableId, final Row row,
                            final Collection<IndexSchema> indices); List<Put> insertIndices(long tableId, final Row row,
                                   final Collection<IndexSchema> indices); List<Delete> delete(long tableId, final Row row); List<Delete> deleteIndices(long tableId, final Row row); List<Delete> deleteIndices(long tableId, final Row row,
                                      final Collection<IndexSchema> indices);  }
@Test(expected = IllegalArgumentException.class) public void testDeleteRejectsInvalidTableId() throws Exception { factory.delete(-1, row); }
@Test(expected = TableNotFoundException.class) public void testDeleteRejectsUnknownTableId() throws Exception { factory.delete(99, row); }
@Test(expected = NullPointerException.class) public void testDeleteRejectsNullRow() throws Exception { factory.delete(1, null); }
@Test public void testDelete() throws Exception { List<Delete> deletes = factory.delete(tableId, row); byte[] rowCounts = countRowTypes(deletes); assertEquals("data row count", 1, rowCounts[DATA_PREFIX]); assertEquals("ascending index count", 2, rowCounts[ASC_PREFIX]); assertEquals("descending index count", 2, rowCounts[DESC_PREFIX]); assertEquals("row count", 5, deletes.size()); }