diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-01-16 09:05:45 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-01-16 09:06:18 +0100 |
commit | e0556fea48459c0a46f99cbc2d03771628669885 (patch) | |
tree | 7486e499921a6370769aae63fe2b473576004503 /sonar-plugin-api | |
parent | 3bc5e63486bb5fe6e8ddf881d718ae211005e89a (diff) | |
download | sonarqube-e0556fea48459c0a46f99cbc2d03771628669885.tar.gz sonarqube-e0556fea48459c0a46f99cbc2d03771628669885.zip |
SONAR-2501 Do nothing when adding a test cover if test does not exist
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java b/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java index 44324b46be8..24c14fa9dba 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java @@ -46,16 +46,18 @@ public class ProjectTestsImpl implements ProjectTests, BatchExtension { FileTest fileTest = getFileTest(fileTestKey); fileTest.addTest(test); - LOG.debug("Added a new test : " + toString()); + LOG.info("Added a new test : " + toString()); } - public List<FileTest> getFileTests() { - return fileTests; + public void cover(String fileTestKey, String test, String mainFile, Collection<Integer> lines) { + FileTest fileTest = find(fileTestKey); + if (fileTest != null) { + LOG.info("Covering - File test : " + fileTestKey + ", test : " + test + ", file : " + mainFile + ", lines : " + Iterables.toString(lines)); + } } - public void cover(String fileTestKey, String test, String mainFile, Collection<Integer> lines){ - FileTest fileTest = find(fileTestKey); - LOG.debug("Covering - File test :" + toString() + ", test:" + test + ", file:" + mainFile+ ", lines:"+ Iterables.toString(lines)); + public List<FileTest> getFileTests() { + return fileTests; } private FileTest getFileTest(final String key) { @@ -67,7 +69,7 @@ public class ProjectTestsImpl implements ProjectTests, BatchExtension { return fileTest; } - private FileTest find(final String key){ + private FileTest find(final String key) { return Iterables.find(fileTests, new Predicate<FileTest>() { public boolean apply(FileTest fileTest) { return fileTest.getKey().equals(key); |