View Javadoc

    1   /*
    2    * This file is part of dependency-check-core.
    3    *
    4    * Dependency-check-core 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-core 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-core. If not, see http://www.gnu.org/licenses/.
    16   *
    17   * Copyright (c) 2013 Jeremy Long. All Rights Reserved.
    18   */
    19  package org.owasp.dependencycheck.dependency;
    20
    21  import org.junit.After;
    22  import org.junit.AfterClass;
    23  import org.junit.Before;
    24  import org.junit.BeforeClass;
    25  import org.junit.Test;
    26  import static org.junit.Assert.*;
    27
    28  /**
    29   *
    30   * @author Jeremy Long (jeremy.long@owasp.org)
    31   */
    32  public class VulnerableSoftwareTest {
    33
    34      public VulnerableSoftwareTest() {
    35      }
    36
    37      @BeforeClass
    38      public static void setUpClass() throws Exception {
    39      }
    40
    41      @AfterClass
    42      public static void tearDownClass() throws Exception {
    43      }
    44
    45      @Before
    46      public void setUp() {
    47      }
    48
    49      @After
    50      public void tearDown() {
    51      }
    52
    53      /**
    54       * Test of equals method, of class VulnerableSoftware.
    55       */
    56      @Test
    57      public void testEquals() {
    58          VulnerableSoftware obj = new VulnerableSoftware();
    59          obj.setCpe("cpe:/a:mortbay:jetty:6.1.0");
    60          VulnerableSoftware instance = new VulnerableSoftware();
    61          instance.setCpe("cpe:/a:mortbay:jetty:6.1");
    62          boolean expResult = false;
    63          boolean result = instance.equals(obj);
    64          assertEquals(expResult, result);
    65      }
    66
    67      /**
    68       * Test of hashCode method, of class VulnerableSoftware.
    69       */
    70      @Test
    71      public void testHashCode() {
    72          VulnerableSoftware instance = new VulnerableSoftware();
    73          instance.setCpe("cpe:/a:mortbay:jetty:6.1");
    74          int expResult = 1849413912;
    75          int result = instance.hashCode();
    76          assertEquals(expResult, result);
    77      }
    78
    79      /**
    80       * Test of compareTo method, of class VulnerableSoftware.
    81       */
    82      @Test
    83      public void testCompareTo() {
    84          VulnerableSoftware vs = new VulnerableSoftware();
    85          vs.setCpe("cpe:/a:mortbay:jetty:6.1.0");
    86          VulnerableSoftware instance = new VulnerableSoftware();
    87          instance.setCpe("cpe:/a:mortbay:jetty:6.1");
    88          int expResult = -2;
    89          int result = instance.compareTo(vs);
    90          assertEquals(expResult, result);
    91      }
    92  }