HandlerProxy { public void createTable(String tableName, byte[] serializedTableSchema, long autoInc) { Verify.isNotNullOrEmpty(tableName); checkNotNull(serializedTableSchema, "Schema cannot be null"); store = storeFactory.createStore(tableName); TableSchema tableSchema = TableSchema.deserialize(serializedTableSchema); Verify.isValidTableSchema(tableSchema); store.createTable(tableName, tableSchema); store.incrementAutoInc(tableName, autoInc); } HandlerProxy(StoreFactory storeFactory); void createTable(String tableName,
                            byte[] serializedTableSchema, long autoInc); void dropTable(String tableName); void openTable(String tableName); void closeTable(); String getTableName(); void renameTable(final String originalName,
                            final String newName); long getRowCount(); void incrementRowCount(long amount); void truncateRowCount(); long getAutoIncrement(); void setAutoIncrement(long value); long incrementAutoIncrement(long amount); void truncateAutoIncrement(); void addIndex(String indexName, byte[] serializedSchema); void dropIndex(String indexName); boolean indexContainsDuplicate(String indexName, byte[] serializedRow); void insertRow(byte[] rowBytes); void deleteRow(byte[] rowBytes); void updateRow(byte[] oldRowBytes, byte[] rowBytes); void deleteAllRows(); void truncateTable(); void flush(); void startTableScan(); void startIndexScan(byte[] indexKeys); byte[] getNextRow(); byte[] getRow(byte[] uuid); void endScan();  }
@Test(expected = NullPointerException.class) public void testCreateTableInvalidTableName() { proxy.createTable(null, TABLE_SCHEMA.serialize(), 0); }
@Test(expected = IllegalArgumentException.class) public void testCreateTableEmptyTableName() { proxy.createTable("", TABLE_SCHEMA.serialize(), 0); }
@Test(expected = NullPointerException.class) public void testCreateTableInvalidTableSchema() { proxy.createTable(TEST_TABLE_NAME, null, 0); }
@Test public void testCreateTable() { when(storeFactory.createStore(anyString())).thenReturn(storageMock); final long incrementValue = 42; proxy.createTable(TEST_TABLE_NAME, TABLE_SCHEMA.serialize(), incrementValue); verify(storeFactory, times(1)).createStore(eq(TEST_TABLE_NAME)); verify(storageMock, times(1)).createTable(eq(TEST_TABLE_NAME), eq(TABLE_SCHEMA)); verify(storageMock, times(1)).incrementAutoInc(eq(TEST_TABLE_NAME), eq(incrementValue)); }