|
|
|
|
@ -28,6 +28,7 @@ import org.springframework.util.ReflectionUtils;
@@ -28,6 +28,7 @@ import org.springframework.util.ReflectionUtils;
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Unit tests for {@link ContentDisposition} |
|
|
|
|
@ -36,7 +37,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
@@ -36,7 +37,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|
|
|
|
*/ |
|
|
|
|
public class ContentDispositionTests { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void parseTest() { |
|
|
|
|
ContentDisposition disposition = ContentDisposition |
|
|
|
|
@ -198,4 +198,22 @@ public class ContentDispositionTests {
@@ -198,4 +198,22 @@ public class ContentDispositionTests {
|
|
|
|
|
ReflectionUtils.invokeMethod(decode, null, "UTF-16''test")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void decodeHeaderFieldParamShortInvalidEncodedFilename() { |
|
|
|
|
Method decode = ReflectionUtils.findMethod(ContentDisposition.class, |
|
|
|
|
"decodeHeaderFieldParam", String.class); |
|
|
|
|
ReflectionUtils.makeAccessible(decode); |
|
|
|
|
assertThatIllegalArgumentException().isThrownBy(() -> |
|
|
|
|
ReflectionUtils.invokeMethod(decode, null, "UTF-8''%A")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void decodeHeaderFieldParamLongerInvalidEncodedFilename() { |
|
|
|
|
Method decode = ReflectionUtils.findMethod(ContentDisposition.class, |
|
|
|
|
"decodeHeaderFieldParam", String.class); |
|
|
|
|
ReflectionUtils.makeAccessible(decode); |
|
|
|
|
assertThatIllegalArgumentException().isThrownBy(() -> |
|
|
|
|
ReflectionUtils.invokeMethod(decode, null, "UTF-8''%A.txt")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|