Improve watcher test by preventing a npe when closing the http client.
This commit is contained in:
parent
7cefba78c5
commit
225d841212
|
@ -76,9 +76,10 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
public class HttpClientTests extends ESTestCase {
|
||||
|
||||
private MockWebServer webServer = new MockWebServer();
|
||||
private final MockWebServer webServer = new MockWebServer();
|
||||
private final Environment environment = TestEnvironment.newEnvironment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
|
||||
private HttpClient httpClient;
|
||||
private Environment environment = TestEnvironment.newEnvironment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
|
@ -92,8 +93,10 @@ public class HttpClientTests extends ESTestCase {
|
|||
@After
|
||||
public void shutdown() throws IOException {
|
||||
webServer.close();
|
||||
if (httpClient != null) {
|
||||
httpClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void testBasics() throws Exception {
|
||||
int responseCode = randomIntBetween(200, 203);
|
||||
|
|
Loading…
Reference in New Issue