Skip to content

Commit 5016315

Browse files
committed
improve other example tests
1 parent 1a8f331 commit 5016315

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

src/test/java/software/amazon/encryption/s3/examples/AsyncClientExampleTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
import org.junit.jupiter.api.Test;
44
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
55

6+
import static org.junit.jupiter.api.Assertions.fail;
7+
68
public class AsyncClientExampleTest {
79

810
@Test
911
public void testAsyncClientExamples() {
1012
final String bucket = S3EncryptionClientTestResources.BUCKET;
11-
AsyncClientExample.main(new String[]{bucket});
13+
try {
14+
AsyncClientExample.main(new String[]{bucket});
15+
} catch (Throwable exception) {
16+
exception.printStackTrace();
17+
fail("Async Example Test Failed!!", exception);
18+
}
1219
}
1320
}

src/test/java/software/amazon/encryption/s3/examples/ClientConfigurationExampleTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
import org.junit.jupiter.api.Test;
44

5+
import static org.junit.jupiter.api.Assertions.fail;
6+
57
public class ClientConfigurationExampleTest {
68
@Test
79
public void testClientConfigurationExamples() {
8-
ClientConfigurationExample.main(new String[0]);
10+
try {
11+
ClientConfigurationExample.main(new String[0]);
12+
} catch (Throwable exception) {
13+
exception.printStackTrace();
14+
fail("Client Configuration Example Test Failed!!", exception);
15+
}
916
}
1017
}

src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
import org.junit.jupiter.api.Test;
44
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
55

6-
import java.io.IOException;
7-
86
import static org.junit.jupiter.api.Assertions.fail;
97

108
public class MultipartUploadExampleTest {
119

1210
@Test
13-
public void testMultipartUploadExamples() throws IOException {
11+
public void testMultipartUploadExamples() {
1412
final String bucket = S3EncryptionClientTestResources.BUCKET;
1513
try {
1614
MultipartUploadExample.main(new String[]{bucket});

src/test/java/software/amazon/encryption/s3/examples/PartialKeyPairExampleTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
import org.junit.jupiter.api.Test;
66
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
77

8+
import static org.junit.jupiter.api.Assertions.fail;
9+
810
public class PartialKeyPairExampleTest {
911

1012
@Test
1113
public void testPartialKeyPairExamples() {
1214
final String bucket = S3EncryptionClientTestResources.BUCKET;
13-
14-
PartialKeyPairExample.main(new String[]{bucket});
15+
try {
16+
PartialKeyPairExample.main(new String[]{bucket});
17+
} catch (Throwable exception) {
18+
exception.printStackTrace();
19+
fail("Partial Key Pair Example Test Failed!!", exception);
20+
}
1521
}
1622
}

src/test/java/software/amazon/encryption/s3/examples/RangedGetExampleTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
import org.junit.jupiter.api.Test;
44
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
55

6+
import static org.junit.jupiter.api.Assertions.fail;
7+
68
public class RangedGetExampleTest {
79

810
@Test
911
public void testRangedGetExamples() {
1012
final String bucket = S3EncryptionClientTestResources.BUCKET;
11-
RangedGetExample.main(new String[]{bucket});
13+
try {
14+
RangedGetExample.main(new String[]{bucket});
15+
} catch (Throwable exception) {
16+
exception.printStackTrace();
17+
fail("Ranged Get Test Failed!!", exception);
18+
}
1219
}
1320
}

0 commit comments

Comments
 (0)