@@ -59,7 +59,6 @@ class MinioTransporterIT {
5959 private static final String OBJECT_CONTENT = "content" ;
6060
6161 private MinIOContainer minioContainer ;
62- private MinioClient minioClient ;
6362 private RepositorySystemSession session ;
6463 private ObjectNameMapperFactory objectNameMapperFactory ;
6564
@@ -69,19 +68,19 @@ void startSuite() throws Exception {
6968
7069 minioContainer = new MinIOContainer ("minio/minio:latest" );
7170 minioContainer .start ();
72- minioClient = MinioClient .builder ()
71+ try ( MinioClient minioClient = MinioClient .builder ()
7372 .endpoint (minioContainer .getS3URL ())
7473 .credentials (minioContainer .getUserName (), minioContainer .getPassword ())
75- .build ();
76-
77- minioClient . makeBucket ( MakeBucketArgs . builder (). bucket ( BUCKET_NAME ). build ());
78- try ( FileUtils . TempFile tempFile = FileUtils . newTempFile ()) {
79- Files . write ( tempFile . getPath (), OBJECT_CONTENT . getBytes ( StandardCharsets . UTF_8 ));
80- minioClient . uploadObject ( UploadObjectArgs . builder ( )
81- . bucket ( BUCKET_NAME )
82- . object ( OBJECT_NAME )
83- . filename ( tempFile . getPath (). toString ())
84- . build ());
74+ .build ()) {
75+ minioClient . makeBucket ( MakeBucketArgs . builder (). bucket ( BUCKET_NAME ). build ());
76+ try ( FileUtils . TempFile tempFile = FileUtils . newTempFile ()) {
77+ Files . write ( tempFile . getPath (), OBJECT_CONTENT . getBytes ( StandardCharsets . UTF_8 ));
78+ minioClient . uploadObject ( UploadObjectArgs . builder ()
79+ . bucket ( BUCKET_NAME )
80+ . object ( OBJECT_NAME )
81+ . filename ( tempFile . getPath (). toString () )
82+ . build ());
83+ }
8584 }
8685
8786 session = new DefaultRepositorySystemSession (h -> true );
@@ -135,7 +134,7 @@ void peekWithWrongAuth() throws NoTransporterException {
135134 fail ("Should throw" );
136135 } catch (Exception e ) {
137136 assertInstanceOf (ErrorResponseException .class , e );
138- assertEquals (transporter .classify (e ), Transporter . ERROR_OTHER );
137+ assertEquals (Transporter . ERROR_OTHER , transporter .classify (e ));
139138 }
140139 }
141140 }
@@ -149,7 +148,7 @@ void peekNonexistent() throws NoTransporterException {
149148 fail ("Should throw" );
150149 } catch (Exception e ) {
151150 assertInstanceOf (ErrorResponseException .class , e );
152- assertEquals (transporter .classify (e ), Transporter . ERROR_NOT_FOUND );
151+ assertEquals (Transporter . ERROR_NOT_FOUND , transporter .classify (e ));
153152 }
154153 }
155154 }
@@ -172,7 +171,7 @@ void getNonexistent() throws NoTransporterException {
172171 fail ("Should throw" );
173172 } catch (Exception e ) {
174173 assertInstanceOf (ErrorResponseException .class , e );
175- assertEquals (transporter .classify (e ), Transporter . ERROR_NOT_FOUND );
174+ assertEquals (Transporter . ERROR_NOT_FOUND , transporter .classify (e ));
176175 }
177176 }
178177 }
0 commit comments