Skip to content

Commit

Permalink
fixed rebase errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudenw committed Jan 13, 2025
1 parent e989016 commit 3b1ac56
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ public void cleanup() {
public void testAddIncludedFilter() {
DocumentName dirName = DocumentName.builder(tempDir).build();
underTest.addExcludedFilter(DirectoryFileFilter.INSTANCE);
DocumentNameMatcher matcher = underTest.getDocumentExcluder(dirName);
DocumentNameMatcher excluder = underTest.getDocumentExcluder(dirName);

assertThat(matcher.toString()).isEqualTo("not(DirectoryFileFilter)");
assertThat(matcher.matches(DocumentName.builder(tempDir).build())).isFalse();
assertThat(excluder.toString()).isEqualTo("not(DirectoryFileFilter)");
assertThat(excluder.matches(DocumentName.builder(tempDir).build())).isFalse();

File f = new File(tempDir, "foo.txt");
assertThat(exlcuder.matches(DocumentName.builder(f).build())).isTrue();
assertThat(excluder.matches(DocumentName.builder(f).build())).isTrue();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ private void execExcludeTest(Option option, String[] args) {
DocumentNameMatcher excluder = config.getDocumentExcluder(baseName());
for (String fname : notExcluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isTrue();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isTrue();
}
for (String fname : excluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isFalse();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isFalse();
}
} catch (IOException e) {
fail(e.getMessage());
Expand Down Expand Up @@ -308,11 +308,11 @@ protected void inputExcludeStdTest() {
DocumentNameMatcher excluder = config.getDocumentExcluder(baseName());
for (String fname : excluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isFalse();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isFalse();
}
for (String fname : notExcluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isTrue();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isTrue();
}
} catch (IOException e) {
fail(e.getMessage());
Expand Down Expand Up @@ -372,11 +372,11 @@ private void inputExcludeSizeTest() {
DocumentNameMatcher excluder = config.getDocumentExcluder(baseName());
for (String fname : excluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isFalse();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isFalse();
}
for (String fname : notExcluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isTrue();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isTrue();
}
} catch (IOException e) {
fail(e.getMessage());
Expand All @@ -394,11 +394,11 @@ private void execIncludeTest(Option option, String[] args) {
DocumentNameMatcher excluder = config.getDocumentExcluder(baseName());
for (String fname : excluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isFalse();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isFalse();
}
for (String fname : notExcluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isTrue();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isTrue();
}
} catch (IOException e) {
fail(e.getMessage());
Expand Down Expand Up @@ -438,11 +438,11 @@ protected void inputIncludeStdTest() {
DocumentNameMatcher excluder = config.getDocumentExcluder(baseName());
for (String fname : excluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isFalse();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isFalse();
}
for (String fname : notExcluded) {
DocumentName docName = mkDocName(fname);
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, matcher, docName)).isTrue();
assertThat(excluder.matches(docName)).as(() -> dump(option, fname, excluder, docName)).isTrue();
}
} catch (IOException e) {
fail(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.rat.api.Document;
import org.apache.rat.document.DocumentNameMatcher;
import org.apache.rat.document.DocumentName;
import org.apache.rat.document.FSInfoTest;

public class TestingDocument extends Document {

Expand Down Expand Up @@ -62,7 +63,7 @@ public TestingDocument(Reader reader, String name) {
}

public TestingDocument(IOSupplier<InputStream> inputStream, String name) {
super(DocumentName.builder().setName(name).setBaseName("").setDirSeparator("/").setCaseSensitive(true).build(), DocumentNameMatcher.MATCHES_ALL);
super(DocumentName.builder(FSInfoTest.UNIX).setName(name).setBaseName("").build(), DocumentNameMatcher.MATCHES_ALL);
this.input = inputStream;
this.reader = null;
}
Expand Down

0 comments on commit 3b1ac56

Please sign in to comment.