View Javadoc
1   /*
2    * This file is part of dependency-check-core.
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    *     http://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   * Copyright (c) 2013 Jeremy Long. All Rights Reserved.
17   */
18  package org.owasp.dependencycheck.analyzer;
19  
20  import static org.junit.Assert.assertEquals;
21  import static org.junit.Assert.assertFalse;
22  import static org.junit.Assert.assertTrue;
23  import org.junit.Before;
24  import org.junit.Test;
25  import org.owasp.dependencycheck.BaseTest;
26  
27  import java.io.File;
28  
29  public class NuspecAnalyzerTest extends BaseTest {
30  
31      private NuspecAnalyzer instance;
32  
33      @Before
34      public void setUp() throws Exception {
35          instance = new NuspecAnalyzer();
36          instance.initialize();
37          instance.setEnabled(true);
38      }
39  
40      @Test
41      public void testGetAnalyzerName() {
42          assertEquals("Nuspec Analyzer", instance.getName());
43      }
44  
45      @Test
46      public void testSupportsFileExtensions() {
47          assertTrue(instance.accept(new File("test.nuspec")));
48          assertFalse(instance.accept(new File("test.nupkg")));
49      }
50  
51      @Test
52      public void testGetAnalysisPhaze() {
53          assertEquals(AnalysisPhase.INFORMATION_COLLECTION, instance.getAnalysisPhase());
54      }
55  }
56  
57  // vim: cc=120:sw=4:ts=4:sts=4