### Question:
BaseClient { String executeAndGetBody(OkHttpClient client, Request request, CookieStorage cookieStorage) { try { Response response = execute(client, request, cookieStorage); if(response == null || response.body() == null) { return ""; } return response.body().string(); } catch (IOException e) { e.printStackTrace(); return ""; } }    }### Answer:
@Test public void testExecuteAndGetBody_whenClientReturnsNoBody_shouldReturnEmptyString() { Mockito.when(mockResponse.body()).thenReturn(null); assertThat(baseClient.executeAndGetBody(client, Mockito.mock(Request.class))).isEqualToIgnoringCase(""); }
@Test public void testExecuteAndGetBody_whenResponseBodyStringThrowsIOException_shouldReturnEmptyString() throws IOException { ResponseBody body = Mockito.mock(ResponseBody.class); Mockito.when(mockResponse.body()).thenReturn(body); Mockito.when(body.string()).thenThrow(IOException.class); assertThat(baseClient.executeAndGetBody(client, Mockito.mock(Request.class))).isEqualToIgnoringCase(""); }