View Javadoc

    1   /*
    2    * This file is part of dependency-check-maven.
    3    *
    4    * Dependency-check-maven is free software: you can redistribute it and/or modify it
    5    * under the terms of the GNU General Public License as published by the Free
    6    * Software Foundation, either version 3 of the License, or (at your option) any
    7    * later version.
    8    *
    9    * Dependency-check-maven is distributed in the hope that it will be useful, but
    10   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11   * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    12   * details.
    13   *
    14   * You should have received a copy of the GNU General Public License along with
    15   * dependency-check-maven. If not, see http://www.gnu.org/licenses/.
    16   *
    17   * Copyright (c) 2013 Jeremy Long. All Rights Reserved.
    18   */
    19  package org.owasp.dependencycheck.maven;
    20
    21  import org.apache.maven.plugin.testing.AbstractMojoTestCase;
    22  import java.io.FileOutputStream;
    23  import java.io.OutputStream;
    24  import java.io.File;
    25  import java.util.Locale;
    26  import org.junit.After;
    27  import org.junit.AfterClass;
    28  import org.junit.Before;
    29  import org.junit.BeforeClass;
    30  import org.junit.Test;
    31  import static org.junit.Assert.*;
    32
    33  /**
    34   * TODO - figure out how to get the test harness to work. ATM no tests are
    35   * running.
    36   *
    37   * @author Jeremy Long (jeremy.long@owasp.org)
    38   */
    39  public class DependencyCheckMojoTest extends AbstractMojoTestCase {
    40
    41      public DependencyCheckMojoTest() {
    42      }
    43
    44      @BeforeClass
    45      public static void setUpClass() throws Exception {
    46      }
    47
    48      @AfterClass
    49      public static void tearDownClass() throws Exception {
    50      }
    51
    52      @Before
    53      public void setUp() {
    54      }
    55
    56      @After
    57      public void tearDown() {
    58      }
    59  //
    60  //    /**
    61  //     * Test of execute method, of class DependencyCheckMojo.
    62  //     */
    63  //    @Test
    64  //    public void testExecute() throws Exception {
    65  //        System.out.println("execute");
    66  //        DependencyCheckMojo instance = new DependencyCheckMojo();
    67  //        instance.execute();
    68  //        // TODO review the generated test code and remove the default call to fail.
    69  //        fail("The test case is a prototype.");
    70  //    }
    71  //
    72  //    /**
    73  //     * Test of generate method, of class DependencyCheckMojo.
    74  //     */
    75  //    @Test
    76  //    public void testGenerate_Sink_Locale() throws Exception {
    77  //        System.out.println("generate");
    78  //        org.codehaus.doxia.sink.Sink sink = null;
    79  //        Locale locale = null;
    80  //        DependencyCheckMojo instance = new DependencyCheckMojo();
    81  //        instance.generate(sink, locale);
    82  //        // TODO review the generated test code and remove the default call to fail.
    83  //        fail("The test case is a prototype.");
    84  //    }
    85
    86      /**
    87       * Test of generate method, of class DependencyCheckMojo.
    88       */
    89      @Test
    90      public void testGenerate_Sink_SinkFactory_Locale() throws Exception {
    91          //can't get the test-harness to work.
    92  //        File samplePom = new File(this.getClass().getClassLoader().getResource("sample.xml").toURI());
    93  //        DependencyCheckMojo mojo = (DependencyCheckMojo) lookupMojo("check", samplePom);
    94  //        assertNotNull("Unable to load mojo", mojo);
    95  //
    96  //        File out = mojo.getReportOutputDirectory();
    97  //        OutputStream os = new FileOutputStream(out);
    98  //        MySink sink = new MySink(os);
    99  //        Locale locale = new Locale("en");
    100 //
    101 //
    102 //        mojo.generate(sink, null, locale);
    103 //        sink.close();
    104     }
    105 //    /**
    106 //     * Test of getOutputName method, of class DependencyCheckMojo.
    107 //     */
    108 //    @Test
    109 //    public void testGetOutputName() {
    110 //        System.out.println("getOutputName");
    111 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    112 //        String expResult = "";
    113 //        String result = instance.getOutputName();
    114 //        assertEquals(expResult, result);
    115 //        // TODO review the generated test code and remove the default call to fail.
    116 //        fail("The test case is a prototype.");
    117 //    }
    118 //
    119 //    /**
    120 //     * Test of getCategoryName method, of class DependencyCheckMojo.
    121 //     */
    122 //    @Test
    123 //    public void testGetCategoryName() {
    124 //        System.out.println("getCategoryName");
    125 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    126 //        String expResult = "";
    127 //        String result = instance.getCategoryName();
    128 //        assertEquals(expResult, result);
    129 //        // TODO review the generated test code and remove the default call to fail.
    130 //        fail("The test case is a prototype.");
    131 //    }
    132 //
    133 //    /**
    134 //     * Test of getName method, of class DependencyCheckMojo.
    135 //     */
    136 //    @Test
    137 //    public void testGetName() {
    138 //        System.out.println("getName");
    139 //        Locale locale = null;
    140 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    141 //        String expResult = "";
    142 //        String result = instance.getName(locale);
    143 //        assertEquals(expResult, result);
    144 //        // TODO review the generated test code and remove the default call to fail.
    145 //        fail("The test case is a prototype.");
    146 //    }
    147 //
    148 //    /**
    149 //     * Test of setReportOutputDirectory method, of class DependencyCheckMojo.
    150 //     */
    151 //    @Test
    152 //    public void testSetReportOutputDirectory() {
    153 //        System.out.println("setReportOutputDirectory");
    154 //        File directory = null;
    155 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    156 //        instance.setReportOutputDirectory(directory);
    157 //        // TODO review the generated test code and remove the default call to fail.
    158 //        fail("The test case is a prototype.");
    159 //    }
    160 //
    161 //    /**
    162 //     * Test of getReportOutputDirectory method, of class DependencyCheckMojo.
    163 //     */
    164 //    @Test
    165 //    public void testGetReportOutputDirectory() {
    166 //        System.out.println("getReportOutputDirectory");
    167 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    168 //        File expResult = null;
    169 //        File result = instance.getReportOutputDirectory();
    170 //        assertEquals(expResult, result);
    171 //        // TODO review the generated test code and remove the default call to fail.
    172 //        fail("The test case is a prototype.");
    173 //    }
    174 //
    175 //    /**
    176 //     * Test of getDescription method, of class DependencyCheckMojo.
    177 //     */
    178 //    @Test
    179 //    public void testGetDescription() {
    180 //        System.out.println("getDescription");
    181 //        Locale locale = null;
    182 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    183 //        String expResult = "";
    184 //        String result = instance.getDescription(locale);
    185 //        assertEquals(expResult, result);
    186 //        // TODO review the generated test code and remove the default call to fail.
    187 //        fail("The test case is a prototype.");
    188 //    }
    189 //
    190 //    /**
    191 //     * Test of isExternalReport method, of class DependencyCheckMojo.
    192 //     */
    193 //    @Test
    194 //    public void testIsExternalReport() {
    195 //        System.out.println("isExternalReport");
    196 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    197 //        boolean expResult = false;
    198 //        boolean result = instance.isExternalReport();
    199 //        assertEquals(expResult, result);
    200 //        // TODO review the generated test code and remove the default call to fail.
    201 //        fail("The test case is a prototype.");
    202 //    }
    203 //
    204 //    /**
    205 //     * Test of canGenerateReport method, of class DependencyCheckMojo.
    206 //     */
    207 //    @Test
    208 //    public void testCanGenerateReport() {
    209 //        System.out.println("canGenerateReport");
    210 //        DependencyCheckMojo instance = new DependencyCheckMojo();
    211 //        boolean expResult = false;
    212 //        boolean result = instance.canGenerateReport();
    213 //        assertEquals(expResult, result);
    214 //        // TODO review the generated test code and remove the default call to fail.
    215 //        fail("The test case is a prototype.");
    216 //    }
    217 }