package com.yaoyicloud.render.test;

import static org.junit.Assert.assertTrue;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.Test;
import com.yaoyicloud.tools.DocxUtil;

public class TestDocxOperations {

    @Test
    public void testMergeDocx() throws IOException, InvalidFormatException {

        FileInputStream streamMerge =
            new FileInputStream(getClass().getClassLoader().getResource("docx/check_overview.docx").getFile());
        FileInputStream stream1 =
            new FileInputStream(getClass().getClassLoader().getResource("docx/service_provider_info.docx").getFile());
        FileInputStream stream2 =
            new FileInputStream(getClass().getClassLoader().getResource("docx/check_overview.docx").getFile());

        DocxUtil.mergeDocx(new XWPFDocument(streamMerge),
            List.of(new XWPFDocument(stream1), new XWPFDocument(stream2)),
            "../temp/merged.docx");

        assertTrue(true);
    }

}
