### Question:
BucketManagerImpl implements BucketManager { @Override public void deleteBucket(String volumeName, String bucketName) throws IOException { Preconditions.checkNotNull(volumeName); Preconditions.checkNotNull(bucketName); metadataManager.getLock().acquireLock(BUCKET_LOCK, volumeName, bucketName); try { String bucketKey = metadataManager.getBucketKey(volumeName, bucketName); if (metadataManager.getBucketTable().get(bucketKey) == null) { LOG.debug("bucket: {} not found ", bucketName); throw new OMException("Bucket doesn't exist", BUCKET_NOT_FOUND); } if (!metadataManager.isBucketEmpty(volumeName, bucketName)) { LOG.debug("bucket: {} is not empty ", bucketName); throw new OMException("Bucket is not empty", OMException.ResultCodes.BUCKET_NOT_EMPTY); } commitDeleteBucketInfoToOMDB(bucketKey); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Delete bucket failed for bucket:{} in volume:{}", bucketName, volumeName, ex); } throw ex; } finally { metadataManager.getLock().releaseLock(BUCKET_LOCK, volumeName, bucketName); } } BucketManagerImpl(OMMetadataManager metadataManager);  BucketManagerImpl(OMMetadataManager metadataManager,
                           KeyProviderCryptoExtension kmsProvider);  BucketManagerImpl(OMMetadataManager metadataManager,
      KeyProviderCryptoExtension kmsProvider, boolean isRatisEnabled); @Override void createBucket(OmBucketInfo bucketInfo); @Nullable BucketEncryptionKeyInfo.Builder createBucketEncryptionKeyInfoBuilder(
      BucketEncryptionKeyInfo bek); @Override OmBucketInfo getBucketInfo(String volumeName, String bucketName); @Override void setBucketProperty(OmBucketArgs args); @Override void deleteBucket(String volumeName, String bucketName); @Override List<OmBucketInfo> listBuckets(String volumeName,
      String startBucket, String bucketPrefix, int maxNumOfBuckets); @Override boolean addAcl(OzoneObj obj, OzoneAcl acl); @Override boolean removeAcl(OzoneObj obj, OzoneAcl acl); @Override boolean setAcl(OzoneObj obj, List<OzoneAcl> acls); @Override List<OzoneAcl> getAcl(OzoneObj obj); @Override boolean checkAccess(OzoneObj ozObject, RequestContext context);  }### Answer:
@Test public void testDeleteBucket() throws Exception { thrown.expectMessage("Bucket not found"); OmMetadataManagerImpl metaMgr = createSampleVol(); BucketManager bucketManager = new BucketManagerImpl(metaMgr); for (int i = 0; i < 5; i++) { OmBucketInfo bucketInfo = OmBucketInfo.newBuilder() .setVolumeName("sampleVol") .setBucketName("bucket_" + i) .build(); bucketManager.createBucket(bucketInfo); } for (int i = 0; i < 5; i++) { Assert.assertEquals("bucket_" + i, bucketManager.getBucketInfo( "sampleVol", "bucket_" + i).getBucketName()); } try { bucketManager.deleteBucket("sampleVol", "bucket_1"); Assert.assertNotNull(bucketManager.getBucketInfo( "sampleVol", "bucket_2")); } catch (IOException ex) { Assert.fail(ex.getMessage()); } try { bucketManager.getBucketInfo("sampleVol", "bucket_1"); } catch (OMException omEx) { Assert.assertEquals(ResultCodes.BUCKET_NOT_FOUND, omEx.getResult()); throw omEx; } metaMgr.getStore().close(); }