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