Skip to content

Commit 5f82df4

Browse files
committed
Use ParameterizedTest
1 parent 4718027 commit 5f82df4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

services-custom/s3-transfer-manager/src/test/java/software/amazon/awssdk/transfer/s3/internal/DownloadDirectoryHelperTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import org.junit.jupiter.api.BeforeAll;
4040
import org.junit.jupiter.api.BeforeEach;
4141
import org.junit.jupiter.api.Test;
42+
import org.junit.jupiter.params.ParameterizedTest;
43+
import org.junit.jupiter.params.provider.ValueSource;
4244
import org.mockito.ArgumentCaptor;
4345
import software.amazon.awssdk.core.exception.SdkClientException;
4446
import software.amazon.awssdk.services.s3.model.EncodingType;
@@ -115,13 +117,14 @@ void downloadDirectory_allDownloadsSucceed_failedDownloadsShouldBeEmpty() throws
115117
"key2"));
116118
}
117119

118-
@Test
119-
void invalidKey_shouldThrowException() throws Exception {
120-
assertExceptionThrownForInvalidKeys("../key1");
121-
assertExceptionThrownForInvalidKeys("/../key1");
122-
assertExceptionThrownForInvalidKeys("blah/../../object.dat");
123-
assertExceptionThrownForInvalidKeys("blah/../object/../../blah/another/object.dat");
124-
assertExceptionThrownForInvalidKeys("../{directory-name}-2/object.dat");
120+
@ParameterizedTest
121+
@ValueSource(strings = {"/blah",
122+
"../blah/object.dat",
123+
"blah/../../object.dat",
124+
"blah/../object/../../blah/another/object.dat",
125+
"../{directory-name}-2/object.dat"})
126+
void invalidKey_shouldThrowException(String testingString) throws Exception {
127+
assertExceptionThrownForInvalidKeys(testingString);
125128
}
126129

127130
private void assertExceptionThrownForInvalidKeys(String key) throws IOException {

0 commit comments

Comments
 (0)