Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

Commit

Permalink
Adding missing test, renaming config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablissimo committed Feb 4, 2017
1 parent 95f6cef commit 1065a4d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static TsLintExecutorConfig fromSettings(Settings settings, SensorContext
return toReturn;
}

public Boolean useAlreadyExistsTsLintOutput() {
public Boolean useExistingTsLintOutput() {
return this.pathToTsLintOutput != null && !this.pathToTsLintOutput.isEmpty();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ else if (files == null) {
throw new IllegalArgumentException("files");
}

if (config.useAlreadyExistsTsLintOutput()) {
if (config.useExistingTsLintOutput()) {
LOG.debug("Running with existing JSON file '" + config.getPathToTsLintOutput() + "' instead of calling tslint");
List<String> toReturn = new ArrayList<String>();
toReturn.add(this.getFileContent(new File(config.getPathToTsLintOutput())));
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/com/pablissimo/sonar/TsLintExecutorConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ public void useTsConfigInsteadOfFileList_returnsFalse_ifPathToTsConfigNotSet() {

assertFalse(config.useTsConfigInsteadOfFileList());
}

@Test
public void useExistingTsLintOutput_returnsTrueIfPathSet() {
TsLintExecutorConfig config = getNewConfig();
config.setPathToTsLintOutput("/path/to/tslint/json/output");

assertTrue(config.useExistingTsLintOutput());
}

@Test
public void useExistingTsLintOutput_returnsFalseIfPathNotSet() {
TsLintExecutorConfig config = getNewConfig();
config.setPathToTsLintOutput("");

assertFalse(config.useExistingTsLintOutput());
}

@Test
public void fromSettings_initialisesFromSettingsAndResolver() {
Expand Down

0 comments on commit 1065a4d

Please sign in to comment.