### Question:
HiveClient implements CleanerClient { @Override public boolean dropPartition(String databaseName, String tableName, String partitionName) { boolean partitionDeleted = true; if (dryRunEnabled) { log.info("Dry run - dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); } else { try { log.info("Dropping partition \"{}\" from table \"{}.{}\"", partitionName, databaseName, tableName); client.dropPartition(databaseName, tableName, partitionName, false); } catch (NoSuchObjectException e) { log .info("Could not drop partition \"{}\" from table \"{}.{}\". Partition does not exist.", partitionName, databaseName, tableName); partitionDeleted = false; } catch (TException e) { throw new BeekeeperException("Unexpected exception when dropping partition \"" + partitionName + "\" from table: \"" + databaseName + "." + tableName + "\".", e); } } return partitionDeleted; } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); @Override void dropTable(String databaseName, String tableName); @Override boolean dropPartition(String databaseName, String tableName, String partitionName); @Override boolean tableExists(String databaseName, String tableName); @Override void close();  }### Answer:
@Test public void typicalDropPartition() throws TException { boolean result = hiveClient.dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME); verify(client).dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); assertTrue(result); }
@Test public void typicalDropPartitionDryRun() throws TException { hiveClient = new HiveClient(client, true); boolean result = hiveClient.dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME); verify(client, never()).dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); assertTrue(result); }
@Test public void dontThrowErrorWhenPartitionAlreadyDropped() throws TException { Mockito .doThrow(NoSuchObjectException.class) .when(client) .dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); boolean result = hiveClient.dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME); verify(client).dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); assertFalse(result); }
@Test public void throwsExceptionForDropPartition() throws TException { Mockito.doThrow(MetaException.class).when(client).dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME, false); assertThrows(BeekeeperException.class, () -> { hiveClient.dropPartition(DATABASE, TABLE_NAME, PARTITION_NAME); }); }