public void deleteTenant(TenantName name) {
        if (name.equals(DEFAULT_TENANT))
            throw new IllegalArgumentException("Deleting 'default' tenant is not allowed");
        if ( ! tenants.containsKey(name))
            throw new IllegalArgumentException("Deleting '" + name + "' failed, tenant does not exist");

        log.log(Level.INFO, "Deleting tenant '" + name + "'");
        // Deletes the tenant tree from ZooKeeper (application and session status for the tenant)
        // and triggers Tenant.close().
        try (Lock lock = tenantLocks.lock(name)) {
            Path path = tenants.get(name).getPath();
            closeTenant(name);
            curator.delete(path);
        }
    }
@Test
    public void testDeleteTenant() throws Exception {
        assertZooKeeperTenantPathExists(tenant1);
        tenantRepository.deleteTenant(tenant1);
        assertFalse(tenantRepository.getAllTenantNames().contains(tenant1));

        try {
            tenantRepository.deleteTenant(TenantName.from("non-existing"));
            fail("deletion of non-existing tenant should fail");
        } catch (IllegalArgumentException e) {
            // expected
        }
    }