@SneakyThrows
    public boolean isDirExists(String dirName) {
        boolean exists = false;

        Iterable<Result<Item>> objects = minioClient.listObjects(ListObjectsArgs.builder()
                .bucket(bucketName)
                .prefix(dirName)
                .recursive(false)
                .build()
        );

        for (Result<Item> object : objects) {
            Item item = object.get();
            System.out.println("item.objectName() = " + item.objectName());
            if (item.isDir() && item.objectName().replace("/", "").equals(dirName)) {
                exists = true;
            }
        }

        return exists;
    }
@Test
    void isDirExists() {
        boolean dirExists = minioService.isDirExists("test");
        System.out.println("dirExists = " + dirExists);
        assert !dirExists;
    }