pptx-test

pptx-test

pptx-test

Отличные новости ))

Если вам нужно валидировать PowerPoint файлы в тестах, есть небольшое и классное решение:

https://github.com/kozikoff/pptx-test

Как использовать

import PPTX;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static PPTX.containsText;
import static org.hamcrest.MatcherAssert.assertThat;

public class ContainsTextTests {

    @Test
    void canAssertThatPptxContainsText() throws IOException {
        PPTX pptx = new PPTX(getClass().getClassLoader().getResource("TestPPTX.pptx"));
        assertThat(pptx, containsText("lacinia nisi. Ut ac dolor vitae odio"));
        assertThat(pptx, containsText("My pretty chart"));
        assertThat(pptx, containsText("37.12%"));
        assertThat(pptx, containsText("Beehive State (official), The Mormon State"));
    }
}

Как добавить в ваш проект

Просто скопируйте jar-файл в директорию lib вашего проекта и сделайте импорт в IntelliJ IDEA (Project structure - Modules - Dependencies). Если вы используете Gradle, добавьте следующую зависимость в build.gradle:

dependencies {
    testImplementation files('lib/pptx-test.jar')
}