-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from gtudan/master
fix sonar issues and improved test coverage
- Loading branch information
Showing
10 changed files
with
266 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target/ | ||
*.iml | ||
.idea | ||
.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...check-plugin/src/test/java/org/sonar/dependencycheck/rule/KnownCveRuleDefinitionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Dependency-Check Plugin for SonarQube | ||
* Copyright (C) 2015-2017 Steve Springett | ||
* steve.springett@owasp.org | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package org.sonar.dependencycheck.rule; | ||
|
||
import org.junit.Test; | ||
import org.mockito.InOrder; | ||
import org.sonar.api.server.rule.RulesDefinition; | ||
import org.sonar.dependencycheck.DependencyCheckPlugin; | ||
|
||
import static org.mockito.Matchers.anyString; | ||
import static org.mockito.Mockito.*; | ||
|
||
/** | ||
* @author Gregor Tudan, Cofinpro AG | ||
*/ | ||
public class KnownCveRuleDefinitionTest { | ||
|
||
private KnownCveRuleDefinition rule = new KnownCveRuleDefinition(); | ||
|
||
@Test | ||
public void define() throws Exception { | ||
final RulesDefinition.Context context = mock(RulesDefinition.Context.class); | ||
final RulesDefinition.NewRepository repo = mock(RulesDefinition.NewRepository.class); | ||
final RulesDefinition.NewRule rule = mock(RulesDefinition.NewRule.class, RETURNS_SMART_NULLS); | ||
|
||
when(repo.createRule(DependencyCheckPlugin.RULE_KEY)).thenReturn(rule); | ||
when(context.createRepository(anyString(), anyString())).thenReturn(repo); | ||
|
||
this.rule.define(context); | ||
|
||
InOrder inOrder = inOrder(context, repo); | ||
|
||
inOrder.verify(context).createRepository("OWASP","neutral"); | ||
inOrder.verify(repo).createRule(DependencyCheckPlugin.RULE_KEY); | ||
|
||
inOrder.verify(repo).done(); | ||
inOrder.verifyNoMoreInteractions(); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...ndency-check-plugin/src/test/java/org/sonar/dependencycheck/rule/NeutralLanguageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Dependency-Check Plugin for SonarQube | ||
* Copyright (C) 2015-2017 Steve Springett | ||
* steve.springett@owasp.org | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package org.sonar.dependencycheck.rule; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.fest.assertions.Assertions.assertThat; | ||
|
||
|
||
/** | ||
* @author Gregor Tudan, Cofinpro AG | ||
*/ | ||
public class NeutralLanguageTest { | ||
@Test | ||
public void getFileSuffixes() throws Exception { | ||
assertThat(new NeutralLanguage().getFileSuffixes()).isEmpty(); | ||
} | ||
|
||
} |
Oops, something went wrong.