@Test public void testIsNotConnectedWhenLoginResultIsNull() throws Exception { SalesforceConnector connector = new SalesforceConnector(); PartnerConnection partnerConnection = Mockito.mock(PartnerConnection.class); connector.setConnection(partnerConnection); BulkConnection bulkConnection = Mockito.mock(BulkConnection.class); connector.setBulkConnection(bulkConnection); assertFalse(connector.isConnected()); }
@Test public void testIsConnected() throws Exception { SalesforceConnector connector = new SalesforceConnector(); PartnerConnection partnerConnection = Mockito.mock(PartnerConnection.class); LoginResult loginResult = Mockito.mock(LoginResult.class); connector.setConnection(partnerConnection); connector.setLoginResult(loginResult); BulkConnection bulkConnection = Mockito.mock(BulkConnection.class); connector.setBulkConnection(bulkConnection); when(loginResult.getSessionId()).thenReturn(MOCKED_ID); assertTrue(connector.isConnected()); }
@Test public void testIsNotConnectedWhenConnectionIsNull() throws Exception { SalesforceConnector connector = new SalesforceConnector(); assertFalse(connector.isConnected()); }