ZonkyApiTokenSupplier implements Supplier<ZonkyApiToken>,
        AutoCloseable { @Override public void close() { isClosed.set(true); LOGGER.debug("Token closed."); } ZonkyApiTokenSupplier(final ApiProvider apis, final SecretProvider secrets); boolean isClosed(); @Override ZonkyApiToken get(); @Override void close();  }
@Test void notClosingWhenExpired() { final Zonky zonky = mock(Zonky.class); final OAuth oAuth = mock(OAuth.class); final ZonkyApiToken token = getTokenExpiringIn(Duration.ZERO); when(oAuth.refresh(any())).thenAnswer(invocation -> token); final ApiProvider api = mockApi(oAuth, zonky); final ZonkyApiTokenSupplier t = new ZonkyApiTokenSupplier(api, secrets); t.close(); }