@Test
public void testInvalidCredentialFromAccessTokenProvider() throws Exception {

  Configuration config = new Configuration();
  config.set("fs.gs.auth.access.token.provider.impl", TestingAccessTokenProvider.class.getName());
  URI gsUri = new URI("gs://foobar/");
  GoogleHadoopFileSystem ghfs = new GoogleHadoopFileSystem();
  ghfs.initialize(gsUri, config);
  IOException thrown = assertThrows(IOException.class, () -> ghfs.exists(new Path("gs://")));
  assertThat(thrown).hasCauseThat().hasMessageThat().contains("Invalid Credentials");
}