-
Notifications
You must be signed in to change notification settings - Fork 53
/
WordServiceTests.java
50 lines (39 loc) · 1.19 KB
/
WordServiceTests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.yws.demo.word2pdf;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ResourceUtils;
import javax.annotation.Resource;
import java.io.File;
/**
* @author Felix Yan
* @data 2018/07/16
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class WordServiceTests {
@Resource
private WordService commandWordService;
@Resource
private WordService asposeWordService;
@Resource
private WordService unoWordService;
@Test
public void testAsposeWord2Pdf() throws Exception {
test(asposeWordService);
}
@Test
public void testLibreOfficeCommandWord2Pdf() throws Exception {
test(commandWordService);
}
@Test
public void testLibreOfficeUnoWord2Pdf() throws Exception {
test(unoWordService);
}
public void test(WordService wordService) throws Exception {
File file = ResourceUtils.getFile("classpath:test.docx");
File outFile = new File("./test.pdf");
wordService.word2pdf(file.getAbsolutePath(), outFile.getAbsolutePath());
}
}