1515
1616package software .amazon .awssdk .http .urlconnection ;
1717
18- import static org .junit .jupiter .api .Assertions .assertEquals ;
19- import static org .junit .jupiter .api .Assertions .assertThrows ;
18+ import static org .assertj .core .api .Assertions .assertThat ;
2019import static software .amazon .awssdk .testutils .service .S3BucketUtils .temporaryBucketName ;
2120
2221import java .io .ByteArrayOutputStream ;
2322import java .io .IOException ;
2423import java .nio .charset .StandardCharsets ;
25- import java .util .UUID ;
2624import java .util .zip .GZIPOutputStream ;
27-
28- import org .junit .jupiter .api .AfterAll ;
29- import org .junit .jupiter .api .BeforeAll ;
30- import org .junit .jupiter .api .Test ;
25+ import org .junit .AfterClass ;
26+ import org .junit .BeforeClass ;
27+ import org .junit .Test ;
3128import software .amazon .awssdk .core .sync .RequestBody ;
3229import software .amazon .awssdk .services .s3 .model .HeadObjectResponse ;
33- import software .amazon .awssdk .services .s3 .model .NoSuchBucketException ;
3430import software .amazon .awssdk .services .s3 .model .PutObjectRequest ;
3531
3632public class HeadObjectIntegrationTest extends UrlHttpConnectionS3IntegrationTestBase {
3733 private static final String BUCKET = temporaryBucketName (HeadObjectIntegrationTest .class );
3834
3935 private static final String GZIPPED_KEY = "some-key" ;
4036
41- @ BeforeAll
37+ @ BeforeClass
4238 public static void setupFixture () throws IOException {
4339 createBucket (BUCKET );
4440
@@ -54,23 +50,15 @@ public static void setupFixture() throws IOException {
5450 RequestBody .fromBytes (baos .toByteArray ()));
5551 }
5652
57- @ AfterAll
58- public static void cleanup () {
59- deleteBucketAndAllContents (BUCKET );
60- }
61-
6253 @ Test
6354 public void syncClientSupportsGzippedObjects () {
6455 HeadObjectResponse response = s3 .headObject (r -> r .bucket (BUCKET ).key (GZIPPED_KEY ));
65- assertEquals (response .contentEncoding (), "gzip" );
56+ assertThat (response .contentEncoding ()). isEqualTo ( "gzip" );
6657 }
6758
68- @ Test
69- public void syncClient_throwsRightException_withGzippedObjects () {
70-
71- assertThrows (NoSuchBucketException .class ,
72- () -> s3 .headObject (r -> r .bucket (BUCKET + UUID .randomUUID ()).key (GZIPPED_KEY )));
73-
59+ @ AfterClass
60+ public static void cleanup () {
61+ deleteBucketAndAllContents (BUCKET );
7462 }
7563
7664}
0 commit comments