1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.tunyk.mvn.plugins.htmlcompressor;
20
21 import org.junit.jupiter.api.AfterAll;
22 import org.junit.jupiter.api.BeforeAll;
23 import org.junit.jupiter.api.BeforeEach;
24 import org.junit.jupiter.api.Test;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31 class HtmlCompressorTest {
32
33
34 private static final Logger LOG = LoggerFactory.getLogger(HtmlCompressorTest.class);
35
36
37
38
39 @BeforeAll
40 static void setUpClass() {
41 LOG.info("Setting up class...");
42 }
43
44
45
46
47 @AfterAll
48 static void tearDownClass() {
49 LOG.info("Test finished.");
50 }
51
52
53
54
55 @BeforeEach
56 void setUp() {
57 LOG.info("Setting up data for testing...");
58 }
59
60
61
62
63
64
65
66 @Test
67 void testCompress() throws Exception {
68 LOG.info("Testing compress method...");
69
70 HtmlCompressor htmlCompressor = new HtmlCompressor("src/test/resources/html", "target/test/htmlcompressor/0");
71 htmlCompressor.compress();
72
73
74 htmlCompressor = new HtmlCompressor("src/test/resources/html", "target/test/htmlcompressor/1", true,
75 "target/test/htmlcompressor/1/integration.js", "src/test/resources/html/integration.js");
76 htmlCompressor.compress();
77
78
79 htmlCompressor = new HtmlCompressor("src/test/resources/html", "target/test/htmlcompressor/2");
80 com.googlecode.htmlcompressor.compressor.HtmlCompressor htmlCompressorHandler = new com.googlecode.htmlcompressor.compressor.HtmlCompressor();
81 htmlCompressorHandler.setEnabled(false);
82 htmlCompressor.setHtmlCompressor(htmlCompressorHandler);
83 htmlCompressor.compress();
84
85
86 LOG.info("Passed");
87 }
88 }