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.data.update;
    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   * Rigorous test of setters/getters.
    30   *
    31   * @author Jeremy Long (jeremy.long@owasp.org)
    32   */
    33  public class NvdCveInfoTest {
    34
    35      public NvdCveInfoTest() {
    36      }
    37
    38      @BeforeClass
    39      public static void setUpClass() {
    40      }
    41
    42      @AfterClass
    43      public static void tearDownClass() {
    44      }
    45
    46      @Before
    47      public void setUp() {
    48      }
    49
    50      @After
    51      public void tearDown() {
    52      }
    53
    54      /**
    55       * Test of setId and getId method, of class NvdCveInfo.
    56       */
    57      @Test
    58      public void testSetGetId() {
    59          NvdCveInfo instance = new NvdCveInfo();
    60          String expResult = "id";
    61          instance.setId(expResult);
    62          String result = instance.getId();
    63          assertEquals(expResult, result);
    64      }
    65
    66      /**
    67       * Test of getUrl method, of class NvdCveInfo.
    68       */
    69      @Test
    70      public void testSetGetUrl() {
    71          NvdCveInfo instance = new NvdCveInfo();
    72          String expResult = "http://www.someurl.com/something";
    73          instance.setUrl(expResult);
    74          String result = instance.getUrl();
    75          assertEquals(expResult, result);
    76      }
    77
    78      /**
    79       * Test of getOldSchemaVersionUrl method, of class NvdCveInfo.
    80       */
    81      @Test
    82      public void testSetGetOldSchemaVersionUrl() {
    83          NvdCveInfo instance = new NvdCveInfo();
    84          String expResult = "http://www.someurl.com/something";
    85          instance.setOldSchemaVersionUrl(expResult);
    86          String result = instance.getOldSchemaVersionUrl();
    87          assertEquals(expResult, result);
    88      }
    89
    90      /**
    91       * Test of getTimestamp method, of class NvdCveInfo.
    92       */
    93      @Test
    94      public void testSetGetTimestamp() {
    95          NvdCveInfo instance = new NvdCveInfo();
    96          long expResult = 1337L;
    97          instance.setTimestamp(expResult);
    98          long result = instance.getTimestamp();
    99          assertEquals(expResult, result);
    100     }
    101
    102     /**
    103      * Test of getNeedsUpdate method, of class NvdCveInfo.
    104      */
    105     @Test
    106     public void testSetGetNeedsUpdate() {
    107         NvdCveInfo instance = new NvdCveInfo();
    108         boolean expResult = true;
    109         instance.setNeedsUpdate(expResult);
    110         boolean result = instance.getNeedsUpdate();
    111         assertEquals(expResult, result);
    112     }
    113 }