@Test(expected = MetaStoreException.class) public void createTable_shouldWrapTException() throws Exception { when(locationResolver.resolveLocation(anyString(), anyBoolean())).thenReturn(location); when( hiveTableStrategy.newHiveTable(anyString(), anyString(), anyString(), anyString(), any(Schema.class), anyInt())) .thenReturn(table); doThrow(TException.class).when(metaStoreClient).createTable(table); underTest.createTable(TABLE, PARTITION_COLUMN, schema, 1, "owner"); }
public Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner) throws MetaStoreException { try { URI location = locationResolver.resolveLocation(databaseName + "/" + tableName, true); Table table = hiveTableStrategy.newHiveTable(databaseName, tableName, partitionColumnName, location.toString(), schema, version); table.setOwner(owner); metaStoreClient.createTable(table); return table; } catch (TException e) { throw new MetaStoreException(e); } }
HiveTableManager { public Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner) throws MetaStoreException { try { URI location = locationResolver.resolveLocation(databaseName + "/" + tableName, true); Table table = hiveTableStrategy.newHiveTable(databaseName, tableName, partitionColumnName, location.toString(), schema, version); table.setOwner(owner); metaStoreClient.createTable(table); return table; } catch (TException e) { throw new MetaStoreException(e); } } }
HiveTableManager { public Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner) throws MetaStoreException { try { URI location = locationResolver.resolveLocation(databaseName + "/" + tableName, true); Table table = hiveTableStrategy.newHiveTable(databaseName, tableName, partitionColumnName, location.toString(), schema, version); table.setOwner(owner); metaStoreClient.createTable(table); return table; } catch (TException e) { throw new MetaStoreException(e); } }  }
HiveTableManager { public Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner) throws MetaStoreException { try { URI location = locationResolver.resolveLocation(databaseName + "/" + tableName, true); Table table = hiveTableStrategy.newHiveTable(databaseName, tableName, partitionColumnName, location.toString(), schema, version); table.setOwner(owner); metaStoreClient.createTable(table); return table; } catch (TException e) { throw new MetaStoreException(e); } }  boolean tableExists(String tableName); Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner); void grantPublicSelect(String tableName, String grantor); void alterTable(String tableName, Schema schema, int version); int getSchemaVersion(String tableName); }
HiveTableManager { public Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner) throws MetaStoreException { try { URI location = locationResolver.resolveLocation(databaseName + "/" + tableName, true); Table table = hiveTableStrategy.newHiveTable(databaseName, tableName, partitionColumnName, location.toString(), schema, version); table.setOwner(owner); metaStoreClient.createTable(table); return table; } catch (TException e) { throw new MetaStoreException(e); } }  boolean tableExists(String tableName); Table createTable(String tableName, String partitionColumnName, Schema schema, int version, String owner); void grantPublicSelect(String tableName, String grantor); void alterTable(String tableName, Schema schema, int version); int getSchemaVersion(String tableName);  }