diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-04-13 11:59:54 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-04-13 11:59:54 +0200 |
commit | 1434abc6dcf716a06267a109908c7dc920fad9c8 (patch) | |
tree | d64988b92b74bc4372fd1836f4296d9796b676e3 /sonar-plugin-api/src/test/java/org/sonar | |
parent | b80b6a014a747f42f589cc9c7cc59b5a42b21e9a (diff) | |
download | sonarqube-1434abc6dcf716a06267a109908c7dc920fad9c8.tar.gz sonarqube-1434abc6dcf716a06267a109908c7dc920fad9c8.zip |
Restore old behavior for InputFile::lines() -> returns 1 for empty files
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/FileMetadataTest.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/FileMetadataTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/FileMetadataTest.java index 9e06a3e9e5c..e26451cf82d 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/FileMetadataTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/FileMetadataTest.java @@ -56,7 +56,7 @@ public class FileMetadataTest { FileUtils.touch(tempFile); FileMetadata.Metadata metadata = new FileMetadata().readMetadata(tempFile, Charsets.UTF_8); - assertThat(metadata.lines).isEqualTo(0); + assertThat(metadata.lines).isEqualTo(1); assertThat(metadata.nonBlankLines).isEqualTo(0); assertThat(metadata.hash).isNotEmpty(); assertThat(metadata.originalLineOffsets).containsOnly(0); @@ -219,6 +219,8 @@ public class FileMetadataTest { case 3: assertThat(Hex.encodeHexString(hash)).isEqualTo(md5Hex("baz")); break; + default: + fail("Invalid line"); } } }); @@ -236,7 +238,13 @@ public class FileMetadataTest { @Override public void consume(int lineIdx, @Nullable byte[] hash) { - fail("File is empty and should not report any line hash"); + switch (lineIdx) { + case 1: + assertThat(hash).isNull(); + break; + default: + fail("Invalid line"); + } } }); } |