HandlerProxy { public void renameTable(final String originalName, final String newName) { Verify.isNotNullOrEmpty(originalName, "Original table name must have value."); Verify.isNotNullOrEmpty(newName, "New table name must have value."); checkArgument(!originalName.equals(newName), "New table name must be different than original."); Store store = storeFactory.createStore(originalName); store.renameTable(originalName, newName); tableName = newName; } 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 public void testRenameTable() throws Exception { when(storeFactory.createStore(TEST_TABLE_NAME)).thenReturn(storageMock); final String renamedTableName = "bar/baz"; proxy.renameTable(TEST_TABLE_NAME, renamedTableName); verify(storageMock, times(1)).renameTable(eq(TEST_TABLE_NAME), eq(renamedTableName)); }
@Test(expected = NullPointerException.class) public void testRenameTableNullNewTableName() throws Exception { proxy.renameTable("a", null); }
@Test(expected = IllegalArgumentException.class) public void testRenameTableEmptyNewTableName() throws Exception { proxy.renameTable("a", ""); }
@Test(expected = NullPointerException.class) public void testRenameTableNullOriginalTableName() throws Exception { proxy.renameTable(null, "c"); }
@Test(expected = IllegalArgumentException.class) public void testRenameTableEmptyOriginalTableName() throws Exception { proxy.renameTable("", "c"); }
@Test(expected = IllegalArgumentException.class) public void testRenameTableToSameName() throws Exception { proxy.renameTable("a", "a"); }