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) 2012 Jeremy Long. All Rights Reserved.
    18   */
    19  package org.owasp.dependencycheck.data.cpe;
    20
    21  import org.owasp.dependencycheck.data.cpe.IndexEntry;
    22  import junit.framework.TestCase;
    23  import org.junit.After;
    24  import org.junit.AfterClass;
    25  import org.junit.Before;
    26  import org.junit.BeforeClass;
    27  import org.junit.Test;
    28  import org.junit.Assert;
    29
    30  /**
    31   *
    32   * @author Jeremy Long (jeremy.long@owasp.org)
    33   */
    34  public class IndexEntryTest extends TestCase {
    35
    36      @BeforeClass
    37      public static void setUpClass() throws Exception {
    38      }
    39
    40      @AfterClass
    41      public static void tearDownClass() throws Exception {
    42      }
    43
    44      @Before
    45      @Override
    46      public void setUp() throws Exception {
    47          super.setUp();
    48      }
    49
    50      @After
    51      @Override
    52      public void tearDown() throws Exception {
    53          super.tearDown();
    54      }
    55
    56      /**
    57       * Test of setName method, of class IndexEntry.
    58       *
    59       * @throws Exception is thrown when an exception occurs.
    60       */
    61      @Test
    62      public void testSetName() throws Exception {
    63          String name = "cpe:/a:apache:struts:1.1:rc2";
    64
    65          IndexEntry instance = new IndexEntry();
    66          instance.parseName(name);
    67
    68          Assert.assertEquals("apache", instance.getVendor());
    69          Assert.assertEquals("struts", instance.getProduct());
    70      }
    71  }