private void givenListOfImageNames(String... imageNames) throws DockerAccessException {
        final List<Image> images = new ArrayList<>();

        for(String imageName : imageNames) {
            JsonObject json = new JsonObject();
            json.addProperty(ImageDetails.ID, DigestUtils.sha256Hex(imageName));

            JsonArray repoTags = new JsonArray();
            repoTags.add(imageName);

            json.add(ImageDetails.REPO_TAGS, repoTags);

            images.add(new ImageDetails(json));
        }

        Mockito.lenient().doReturn(images).when(queryService).listImages(Mockito.anyBoolean());
        for(String imageName : imageNames) {
            Mockito.lenient().doReturn(true).when(queryService).hasImage(imageName);
            Mockito.lenient().doReturn(true).when(dockerAccess).removeImage(imageName, false);
            Mockito.lenient().doReturn(true).when(dockerAccess).removeImage(imageName, true);
        }
    }
Mock project with one image that is removed by pattern
src/test/java/io/fabric8/maven/docker/RemoveMojoTest.java