@Test
public void testGetErrorMessage() throws IOException {

  IOException withJsonError =
      googleJsonResponseException(
          42, "Detail Reason", "Detail message", "Top Level HTTP Message");
  assertThat(errorExtractor.getErrorMessage(withJsonError)).isEqualTo("Top Level HTTP Message");
  IOException nullJsonErrorWithMessage =
      googleJsonResponseException(
          /* httpStatus=*/ 42, /* reason=*/ null, /* message=*/ null, "Top Level HTTP Message");
  assertThat(errorExtractor.getErrorMessage(nullJsonErrorWithMessage))
      .isEqualTo("Top Level HTTP Message");
}