public ContentPackUninstallation uninstallContentPack(ContentPack contentPack, ContentPackInstallation installation) {
        /*
         * - Show entities marked for removal and ask user for confirmation
         * - Resolve dependency order of the previously created entities
         * - Stop/pause entities in reverse order
         *      - In case of error: Ignore, log error message (or create system notification), and continue
         * - Remove entities in reverse order
         *      - In case of error: Ignore, log error message (or create system notification), and continue
         * - Remove content pack snapshot
         */
        if (contentPack instanceof ContentPackV1) {
            return uninstallContentPack(installation, (ContentPackV1) contentPack);
        } else {
            throw new IllegalArgumentException("Unsupported content pack version: " + contentPack.version());
        }
    }
@Test
    public void uninstallContentPack() throws NotFoundException {
        /* Test successful uninstall */
        when(patternService.load("dead-beef1")).thenReturn(grokPattern);
        ContentPackUninstallation expectSuccess = ContentPackUninstallation.builder()
                .skippedEntities(ImmutableSet.of())
                .failedEntities(ImmutableSet.of())
                .entities(nativeEntityDescriptors)
                .entityObjects(entityObjectMap)
                .build();

        ContentPackUninstallation resultSuccess = contentPackService.uninstallContentPack(contentPack, contentPackInstallation);
        assertThat(resultSuccess).isEqualTo(expectSuccess);

       /* Test skipped uninstall */
        when(contentPackInstallService.countInstallationOfEntityById(ModelId.of("dead-beef1"))).thenReturn((long) 2);
        ContentPackUninstallation expectSkip = ContentPackUninstallation.builder()
                .skippedEntities(nativeEntityDescriptors)
                .failedEntities(ImmutableSet.of())
                .entities(ImmutableSet.of())
                .entityObjects(ImmutableMap.of())
                .build();
        ContentPackUninstallation resultSkip = contentPackService.uninstallContentPack(contentPack, contentPackInstallation);
        assertThat(resultSkip).isEqualTo(expectSkip);

        /* Test skipped uninstall */
        when(contentPackInstallService.countInstallationOfEntityById(ModelId.of("dead-beef1"))).thenReturn((long) 1);
        when(contentPackInstallService.countInstallationOfEntityByIdAndFoundOnSystem(ModelId.of("dead-beef1"))).thenReturn((long) 1);
        ContentPackUninstallation expectSkip2 = ContentPackUninstallation.builder()
                .skippedEntities(nativeEntityDescriptors)
                .failedEntities(ImmutableSet.of())
                .entities(ImmutableSet.of())
                .entityObjects(ImmutableMap.of())
                .build();
        ContentPackUninstallation resultSkip2 = contentPackService.uninstallContentPack(contentPack, contentPackInstallation);
        assertThat(resultSkip2).isEqualTo(expectSkip2);

        /* Test not found while uninstall */
        when(contentPackInstallService.countInstallationOfEntityById(ModelId.of("dead-beef1"))).thenReturn((long) 1);
        when(contentPackInstallService.countInstallationOfEntityByIdAndFoundOnSystem(ModelId.of("dead-beef1"))).thenReturn((long) 0);
        when(patternService.load("dead-beef1")).thenThrow(new NotFoundException("Not found."));
        ContentPackUninstallation expectFailure = ContentPackUninstallation.builder()
                .skippedEntities(ImmutableSet.of())
                .failedEntities(ImmutableSet.of())
                .entities(ImmutableSet.of())
                .entityObjects(ImmutableMap.of())
                .build();

        ContentPackUninstallation resultFailure = contentPackService.uninstallContentPack(contentPack, contentPackInstallation);
        assertThat(resultFailure).isEqualTo(expectFailure);
    }