Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
S3FilesResourceTest - refactored
public class S3FilesResourceTest {
private static class FakeS3Facade implements S3Facade {
List<S3File> fileList;
public List<S3File> listObjects(String bucketName) {
return fileList;
private S3FilesResource resource;
private FakeS3Facade fakeS3;
public void setUp() throws Exception {
fakeS3 = new FakeS3Facade();
resource = new S3FilesResource();
resource.amazonS3Client = fakeS3;
public void excludeDirectories() throws Exception {
S3File s3File = new S3File("file", "/file.xx");
fakeS3.fileList = asList(new S3File("dir", "/my/dir/"), s3File);
/** Simplest possible test of listS3Files */
public void renderToHtml() throws Exception {
fakeS3.fileList = asList(new S3File("file", "/file.xx"));
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.