package com.testor.module.hazard.service.impl;

import cn.afterturn.easypoi.word.entity.MyXWPFDocument;
import com.alibaba.fastjson.JSON;
import com.testor.StartupApplication;
import com.testor.module.train.course.model.dto.TTrainCourseParam;
import com.tongtech.tfw.backend.common.biz.models.BaseResponse;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.InputStream;

import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = StartupApplication.class)
public class THazardWorkPlanServiceImplTest {

    @Autowired
    private THazardWorkPlanServiceImpl tHazardWorkPlanService;
    @Test
    void getCourseDetail() throws Exception {
        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("word/hazardousWorkPermit/riskAnalysis.docx");
        if(inputStream == null){
            System.out.println("文件不存在");
        }else {
            XWPFDocument document = new MyXWPFDocument(inputStream);
            System.out.println(JSON.toJSONString(document));
        }

    }
}