View Javadoc
1   /*
2    *    Copyright 2011-2025 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package com.tunyk.mvn.plugins.htmlcompressor;
17  
18  import org.apache.maven.plugin.MojoExecutionException;
19  import org.junit.jupiter.api.AfterAll;
20  import org.junit.jupiter.api.BeforeAll;
21  import org.junit.jupiter.api.BeforeEach;
22  import org.junit.jupiter.api.Test;
23  import org.slf4j.Logger;
24  import org.slf4j.LoggerFactory;
25  
26  /**
27   * The Class HtmlCompressorMojoTest.
28   */
29  class HtmlCompressorMojoTest {
30  
31      /** The Constant LOG. */
32      private static final Logger LOG = LoggerFactory.getLogger(HtmlCompressorMojoTest.class);
33  
34      /**
35       * Sets the up class.
36       */
37      @BeforeAll
38      static void setUpClass() {
39          LOG.info("Setting up class...");
40      }
41  
42      /**
43       * Tear down class.
44       */
45      @AfterAll
46      static void tearDownClass() {
47          LOG.info("Mojo test finished.");
48      }
49  
50      /**
51       * Sets the up.
52       */
53      @BeforeEach
54      void setUp() {
55          LOG.info("Setting up data for testing...");
56      }
57  
58      /**
59       * Test execute.
60       *
61       * @throws MojoExecutionException
62       *             the mojo execution exception
63       */
64      @Test
65      void testExecute() throws MojoExecutionException {
66          LOG.info("Testing mojo execution...");
67  
68          HtmlCompressorMojo htmlCompressorMojo = new HtmlCompressorMojo();
69          htmlCompressorMojo.setSrcFolder("src/test/resources/html");
70          htmlCompressorMojo.setJavascriptHtmlSpriteIntegrationFile("src/test/resources/html/integration.js");
71          htmlCompressorMojo.setTargetFolder("target/htmlcompressor/html");
72          htmlCompressorMojo.execute();
73  
74          // TODO: test results
75  
76          LOG.info("Passed");
77      }
78  }