|
22 | 22 | import static org.apache.hadoop.fs.s3a.S3ATestUtils.*;
|
23 | 23 | import static org.apache.hadoop.fs.s3a.S3AUtils.*;
|
24 | 24 | import static org.apache.hadoop.fs.s3a.impl.InternalConstants.SC_404;
|
| 25 | +import static org.apache.hadoop.fs.s3a.impl.InternalConstants.SC_416_RANGE_NOT_SATISFIABLE; |
25 | 26 | import static org.junit.Assert.*;
|
26 | 27 |
|
27 | 28 | import java.io.EOFException;
|
|
38 | 39 | import com.amazonaws.AmazonServiceException;
|
39 | 40 | import com.amazonaws.services.s3.model.AmazonS3Exception;
|
40 | 41 |
|
| 42 | +import org.assertj.core.api.Assertions; |
41 | 43 | import org.junit.Test;
|
42 | 44 |
|
43 | 45 | import org.apache.hadoop.fs.s3a.impl.ErrorTranslation;
|
@@ -80,10 +82,10 @@ protected void assertContained(String text, String contained) {
|
80 | 82 | text != null && text.contains(contained));
|
81 | 83 | }
|
82 | 84 |
|
83 |
| - protected <E extends Throwable> void verifyTranslated( |
| 85 | + protected <E extends Throwable> E verifyTranslated( |
84 | 86 | int status,
|
85 | 87 | Class<E> expected) throws Exception {
|
86 |
| - verifyTranslated(expected, createS3Exception(status)); |
| 88 | + return verifyTranslated(expected, createS3Exception(status)); |
87 | 89 | }
|
88 | 90 |
|
89 | 91 | @Test
|
@@ -128,7 +130,12 @@ public void test410isNotFound() throws Exception {
|
128 | 130 |
|
129 | 131 | @Test
|
130 | 132 | public void test416isEOF() throws Exception {
|
131 |
| - verifyTranslated(416, EOFException.class); |
| 133 | + |
| 134 | + // 416 maps the the subclass of EOFException |
| 135 | + final IOException ex = verifyTranslated(SC_416_RANGE_NOT_SATISFIABLE, |
| 136 | + RangeNotSatisfiableEOFException.class); |
| 137 | + Assertions.assertThat(ex) |
| 138 | + .isInstanceOf(EOFException.class); |
132 | 139 | }
|
133 | 140 |
|
134 | 141 | @Test
|
|
0 commit comments