@Test public void getsLastModifiedDate() throws Exception { final Date date = new Date(); final AmazonS3 client = Mockito.mock(AmazonS3.class); final S3Object object = Mockito.mock(S3Object.class); Mockito.doReturn(object).when(client) .getObject(Mockito.any(GetObjectRequest.class)); final ObjectMetadata meta = Mockito.mock(ObjectMetadata.class); Mockito.doReturn(meta).when(object).getObjectMetadata(); Mockito.doReturn(date).when(meta).getLastModified(); final Resource res = new DefaultResource( client, "x", "", Range.ENTIRE, Version.LATEST, Mockito.mock(DomainStatsData.class) ); MatcherAssert.assertThat( res.lastModified(), Matchers.is(date) ); }
@Override public Date lastModified() { return new Date( this.object.getObjectMetadata().getLastModified().getTime() ); }
DefaultResource implements Resource { @Override public Date lastModified() { return new Date( this.object.getObjectMetadata().getLastModified().getTime() ); } }
DefaultResource implements Resource { @Override public Date lastModified() { return new Date( this.object.getObjectMetadata().getLastModified().getTime() ); } DefaultResource(@NotNull final AmazonS3 clnt,
        @NotNull final String bckt, @NotNull final String name,
        @NotNull final Range rng, @NotNull final Version ver,
        @NotNull final DomainStatsData dstats); }
DefaultResource implements Resource { @Override public Date lastModified() { return new Date( this.object.getObjectMetadata().getLastModified().getTime() ); } DefaultResource(@NotNull final AmazonS3 clnt,
        @NotNull final String bckt, @NotNull final String name,
        @NotNull final Range rng, @NotNull final Version ver,
        @NotNull final DomainStatsData dstats); @Override String toString(); @Override int status(); @Override @Loggable( value = Loggable.DEBUG, limit = Integer.MAX_VALUE, ignore = DefaultResource.StreamingException.class ) long writeTo(@NotNull final OutputStream output); @Override @NotNull Collection<String> headers(); @Override @NotNull String etag(); @Override Date lastModified(); @Override String contentType(); @Override void close(); }
DefaultResource implements Resource { @Override public Date lastModified() { return new Date( this.object.getObjectMetadata().getLastModified().getTime() ); } DefaultResource(@NotNull final AmazonS3 clnt,
        @NotNull final String bckt, @NotNull final String name,
        @NotNull final Range rng, @NotNull final Version ver,
        @NotNull final DomainStatsData dstats); @Override String toString(); @Override int status(); @Override @Loggable( value = Loggable.DEBUG, limit = Integer.MAX_VALUE, ignore = DefaultResource.StreamingException.class ) long writeTo(@NotNull final OutputStream output); @Override @NotNull Collection<String> headers(); @Override @NotNull String etag(); @Override Date lastModified(); @Override String contentType(); @Override void close();  }