When I run the following Junit testing code:
import com.adobe.aemfd.docmanager.Document;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.*;
class TableOfContentTest {
private Document pdfDoc;
private ProcessInputXML processInputXML;
private TableOfContent tableOfContent;
@BeforeEach
void setUp() throws Exception {
// Load valid PDF content from a file or resource
InputStream pdfInputStream = getClass().getResourceAsStream("/logo.pdf"); // Ensure this file exists in resources
pdfDoc = new Document(pdfInputStream);
// Initialize the ProcessInputXML object
org.w3c.dom.Document inputXML = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
processInputXML = new ProcessInputXML(inputXML);
// Create the TableOfContent instance
tableOfContent = new TableOfContent(pdfDoc, processInputXML);
}
@Test
void shouldThrowAnExceptionOrHandleErrorsForANullTocMap() {
// Use the initialized tableOfContent instance
assertNotNull(tableOfContent);
}
}
The error message, java.lang.NoClassDefFoundError: com/adobe/aemfd/docmanager/source/DocumentSourceHandler, occurred at line 24 (
InputStream pdfInputStream = getClass().getResourceAsStream("/logo.pdf");
) and25 (
pdfDoc = new Document(pdfInputStream);
). How can I find out the best resolution, particularly initialization, to avoid java.lang.NoClassDefFoundError: com/adobe/aemfd/docmanager/source/DocumentSourceHandler? Thanks for your help. By the way, when I look for com.adobe.aemfd.docmanager in the import side, I cannot find out source.DocumentSourceHandler. What version of dependency in Maven repository can include com.adobe.aemfd.docmanager.source.DocumentSourceHandler? If so, that's great. Otherwise, what's the best alternative way to be worked out that problem?