use of org.springframework.social.salesforce.api.Salesforce in project syndesis by syndesisio.
the class SalesforceApplicatorTest method shouldApplyAdditionalProperties.
@Test
public void shouldApplyAdditionalProperties() {
final SalesforceProperties properties = new SalesforceProperties();
properties.setAppId("appId");
properties.setAppSecret("appSecret");
final AccessGrant accessGrant = new AccessGrant("accessToken", "scope", "refreshToken", 1L);
final SalesforceConnectionFactory salesforce = mock(SalesforceConnectionFactory.class);
@SuppressWarnings("unchecked") final org.springframework.social.connect.Connection<Salesforce> salesforceConnection = mock(org.springframework.social.connect.Connection.class);
final Salesforce salesforceApi = mock(Salesforce.class);
when(salesforceConnection.getApi()).thenReturn(salesforceApi);
when(salesforceApi.getInstanceUrl()).thenReturn("https://instance.salesforce.com");
when(salesforce.createConnection(accessGrant)).thenReturn(salesforceConnection);
final Connection.Builder mutableConnection = new Connection.Builder();
final SalesforceApplicator applicator = new SalesforceApplicator(salesforce, properties);
applicator.additionalApplication(mutableConnection, accessGrant);
assertThat(mutableConnection.build().getConfiguredProperties()).containsExactly(entry("instanceUrl", "https://instance.salesforce.com"));
}
Aggregations