Skip to content

Commit

Permalink
Test S3RegionResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
inigo-cobian committed Jan 30, 2025
1 parent 7d51d03 commit 97eb6aa
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.integratedmodelling.klab.test.utils;

import org.integratedmodelling.klab.utils.s3.S3RegionResolver;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import software.amazon.awssdk.regions.Region;

public class S3RegionResolverTest {

@Test
public void resolveBucketRegion_resolutionSuccessful() {
String bucket = "deafrica-input-datasets";
String objectKey = "rainfall_chirps_monthly/chirps-v2.0_2024.03.tif";

Region ret = S3RegionResolver.resolveBucketRegion(bucket, objectKey);

Assertions.assertEquals(Region.AF_SOUTH_1, ret);
}

@Test
public void resolveBucketRegion_resolutionUnsuccessful() {
String bucket = "fake-bucket";
String objectKey = "fake-object.tif";

Assertions.assertThrows(RuntimeException.class, () -> {
S3RegionResolver.resolveBucketRegion(bucket, objectKey);
});
}

}

0 comments on commit 97eb6aa

Please sign in to comment.