Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
S3FilesResourceTest - original
public class S3FilesResourceTest {
@Test
public void listFilesButNotDirectoriesAsHtml() throws Exception {
S3FilesResource resource = new S3FilesResource(/* pass AWS credentials ... */);
String html = resource.listS3Files();
assertThat(html)
.contains("<a href='/content?fileName=/dir/file1.txt'>/dir/file1.txt</a>")
.contains("<a href='/content?fileName=/dir/another.txt'>/dir/another.txt</a>")
.doesNotContain("/dir/</a>"); // directories should be excluded
assertThat(html.split(quote("</a>"))).hasSize(2 + 1); // two links only
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.