Skip to content

Instantly share code, notes, and snippets.

@holyjak
Created September 9, 2012 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holyjak/3684047 to your computer and use it in GitHub Desktop.
Save holyjak/3684047 to your computer and use it in GitHub Desktop.
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