/** * Returns the credentials instance from the given access token. * * @param accessToken the access token * @return the credentials instance */ public static GoogleCredentials create(AccessToken accessToken) { return GoogleCredentials.newBuilder().setAccessToken(accessToken).build(); }
/** * Returns the credentials instance from the given access token. * * @param accessToken the access token * @return the credentials instance */ public static GoogleCredentials create(AccessToken accessToken) { return GoogleCredentials.newBuilder().setAccessToken(accessToken).build(); }
@Test @SuppressWarnings("deprecation") public void createWithNullDuration() throws IOException { thrown.expect(NullPointerException.class); thrown.expectMessage("exportInterval"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), PROJECT_ID, null); }
@Test @SuppressWarnings("deprecation") public void createWithNegativeDuration() throws IOException { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Export interval must be positive"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), PROJECT_ID, NEG_ONE_SECOND); }
@Test @SuppressWarnings("deprecation") public void createWithNullProjectId() throws IOException { thrown.expect(NullPointerException.class); thrown.expectMessage("projectId"); StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId( GoogleCredentials.newBuilder().build(), null, ONE_SECOND); }