use of com.sforce.soap.partner.IDescribeGlobalSObjectResult in project components by Talend.
the class SalesforceRuntimeCommonTest method testGetSchemaNames.
@Test
public void testGetSchemaNames() throws Exception {
DescribeGlobalResult result = new DescribeGlobalResult();
DescribeGlobalSObjectResult sObjectResult1 = new DescribeGlobalSObjectResult();
sObjectResult1.setName("Account");
sObjectResult1.setLabel("Account");
DescribeGlobalSObjectResult sObjectResult2 = new DescribeGlobalSObjectResult();
sObjectResult2.setName("Contact");
sObjectResult2.setLabel("Contact");
DescribeGlobalSObjectResult sObjectResult3 = new DescribeGlobalSObjectResult();
sObjectResult3.setName("Campaign");
sObjectResult3.setLabel("Campaign");
result.setSobjects(new IDescribeGlobalSObjectResult[] { sObjectResult1, sObjectResult2, sObjectResult3 });
PartnerConnection conn = mock(PartnerConnection.class);
doReturn(result).when(conn).describeGlobal();
List<NamedThing> schemaNames = SalesforceRuntimeCommon.getSchemaNames(conn);
assertThat(schemaNames, containsInAnyOrder((NamedThing) new SimpleNamedThing("Account", "Account"), new SimpleNamedThing("Contact", "Contact"), new SimpleNamedThing("Campaign", "Campaign")));
}
Aggregations