return this;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- DefaultInputFile that = (DefaultInputFile) o;
- return relativePath.equals(that.relativePath);
- }
-
- @Override
- public int hashCode() {
- return relativePath.hashCode();
- }
-
/**
* @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem#baseDir()}
*/
public InputStream getInputStream() throws FileNotFoundException {
return new BufferedInputStream(new FileInputStream(file()));
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ DefaultInputFile that = (DefaultInputFile) o;
+ return relativePath.equals(that.relativePath);
+ }
+
+ @Override
+ public int hashCode() {
+ return relativePath.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "[relative=" + relativePath + ", abs=" + absolutePath + "]";
+ }
}
assertThat(f1.hashCode()).isEqualTo(f1.hashCode());
assertThat(f1.hashCode()).isEqualTo(f1a.hashCode());
}
+
+ @Test
+ public void test_toString() throws Exception {
+ DefaultInputFile file = new DefaultInputFile("src/Foo.php").setAbsolutePath("/path/to/src/Foo.php");
+ assertThat(file.toString()).isEqualTo("[relative=src/Foo.php, abs=/path/to/src/Foo.php]");
+ }
}