/** * Tests that the builder correctly throws exception when client ID or client * secret is a default value. */ @Test public void testBuilder_defaultClientIdAndSecret() throws Exception { thrown.expect(ValidationException.class); thrown.expectMessage("Client ID must be set." + "\nIf you do not have a client ID or secret, please create one in the API " + "console: https://console.developers.google.com"); new GoogleClientSecretsBuilder() .forApi(GoogleClientSecretsBuilder.Api.AD_MANAGER) .withClientSecrets("INSERT_CLIENT_ID_HERE", "INSERT_CLIENT_SECRET_HERE") .build(); }
/** * Tests that the builder builds correctly. */ @Test public void testBuilder() throws Exception { GoogleClientSecrets clientSecrets = new GoogleClientSecretsBuilder() .forApi(GoogleClientSecretsBuilder.Api.AD_MANAGER) .withClientSecrets("clientId", "clientSecret") .build(); assertNotNull(clientSecrets.getDetails()); assertEquals("clientId", clientSecrets.getDetails().getClientId()); assertEquals("clientSecret", clientSecrets.getDetails().getClientSecret()); }