Skip to content

Commit

Permalink
Support for getFilename() in ModuleResource
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Jun 29, 2023
1 parent 654dee8 commit 31a51cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public Resource createRelative(String relativePath) {
return new ModuleResource(this.module, pathToUse);
}

@Override
@Nullable
public String getFilename() {
return StringUtils.getFilename(this.path);
}

@Override
public String getDescription() {
return "module resource [" + this.path + "]" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void existingResource() throws IOException {
assertThat(mr.isReadable()).isTrue();
assertThat(mr.isOpen()).isFalse();
assertThat(mr.isFile()).isFalse();
assertThat(mr.getFilename()).isEqualTo("Introspector.class");
assertThat(mr.getDescription()).contains(mr.getModule().getName());
assertThat(mr.getDescription()).contains(mr.getPath());

Expand All @@ -55,6 +56,7 @@ void nonExistingResource() {
assertThat(mr.isReadable()).isFalse();
assertThat(mr.isOpen()).isFalse();
assertThat(mr.isFile()).isFalse();
assertThat(mr.getFilename()).isEqualTo("Introspecter.class");
assertThat(mr.getDescription()).contains(mr.getModule().getName());
assertThat(mr.getDescription()).contains(mr.getPath());

Expand Down

0 comments on commit 31a51cc

Please sign in to comment.