DefaultResponseErrorHandler delegate methods declared as protected

Also revises copyToByteArray/String in FileCopyUtils/StreamUtils for lenient null handling.

Issue: SPR-15329
This commit is contained in:
Juergen Hoeller
2017-03-16 18:57:13 +01:00
parent 012c56a1f0
commit ab7db413c6
4 changed files with 110 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package org.springframework.web.client;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpHeaders;
@@ -37,15 +36,10 @@ import static org.mockito.BDDMockito.*;
*/
public class DefaultResponseErrorHandlerTests {
private DefaultResponseErrorHandler handler;
private final DefaultResponseErrorHandler handler = new DefaultResponseErrorHandler();
private ClientHttpResponse response;
private final ClientHttpResponse response = mock(ClientHttpResponse.class);
@Before
public void setUp() throws Exception {
handler = new DefaultResponseErrorHandler();
response = mock(ClientHttpResponse.class);
}
@Test
public void hasErrorTrue() throws Exception {
@@ -103,9 +97,7 @@ public class DefaultResponseErrorHandlerTests {
handler.handleError(response);
}
// SPR-9406
@Test(expected = UnknownHttpStatusCodeException.class)
@Test(expected = UnknownHttpStatusCodeException.class) // SPR-9406
public void unknownStatusCode() throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.TEXT_PLAIN);
@@ -117,4 +109,5 @@ public class DefaultResponseErrorHandlerTests {
handler.handleError(response);
}
}