View Javadoc
1   /*
2    * Copyright (c) 2011-2023 Alex Tunyk <alex at tunyk.com>.
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   * See the NOTICE file distributed with this work for additional information
17   * regarding copyright ownership.
18   */
19  package com.tunyk.mvn.plugins.htmlcompressor;
20  
21  import org.apache.maven.plugin.MojoExecutionException;
22  import org.junit.jupiter.api.AfterAll;
23  import org.junit.jupiter.api.BeforeAll;
24  import org.junit.jupiter.api.BeforeEach;
25  import org.junit.jupiter.api.Test;
26  import org.slf4j.Logger;
27  import org.slf4j.LoggerFactory;
28  
29  /**
30   * The Class HtmlCompressorMojoTest.
31   */
32  class HtmlCompressorMojoTest {
33  
34      /** The Constant LOG. */
35      private static final Logger LOG = LoggerFactory.getLogger(HtmlCompressorMojoTest.class);
36  
37      /**
38       * Sets the up class.
39       */
40      @BeforeAll
41      static void setUpClass() {
42          LOG.info("Setting up class...");
43      }
44  
45      /**
46       * Tear down class.
47       */
48      @AfterAll
49      static void tearDownClass() {
50          LOG.info("Mojo test finished.");
51      }
52  
53      /**
54       * Sets the up.
55       */
56      @BeforeEach
57      void setUp() {
58          LOG.info("Setting up data for testing...");
59      }
60  
61      /**
62       * Test execute.
63       *
64       * @throws MojoExecutionException
65       *             the mojo execution exception
66       */
67      @Test
68      void testExecute() throws MojoExecutionException {
69          LOG.info("Testing mojo execution...");
70  
71          HtmlCompressorMojo htmlCompressorMojo = new HtmlCompressorMojo();
72          htmlCompressorMojo.setSrcFolder("src/test/resources/html");
73          htmlCompressorMojo.setJavascriptHtmlSpriteIntegrationFile("src/test/resources/html/integration.js");
74          htmlCompressorMojo.setTargetFolder("target/htmlcompressor/html");
75          htmlCompressorMojo.execute();
76  
77          // TODO: test results
78  
79          LOG.info("Passed");
80      }
81  }