HiveTableManager { public boolean tableExists(String tableName) throws MetaStoreException { try { return metaStoreClient.tableExists(databaseName, tableName); } 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);  }
@Test public void tableExists() throws Exception { when(metaStoreClient.tableExists(DATABASE, TABLE)).thenReturn(true); boolean result = underTest.tableExists(TABLE); verify(metaStoreClient).tableExists(DATABASE, TABLE); assertThat(result, is(true)); }
@Test(expected = MetaStoreException.class) public void tableExists_shouldWrapTException() throws Exception { doThrow(TException.class).when(metaStoreClient).tableExists(DATABASE, TABLE); underTest.tableExists(TABLE); }