@Test
public void testRetrievePackagesWithTwoReturningSubHandlersAndAllStrategy() throws Exception {
ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
ResourceResolver resourceResolver = mock(ResourceResolver.class);
List<ReplicationTransportHandler> subHandlers = new ArrayList<ReplicationTransportHandler>();
ReplicationTransportHandler handler1 = mock(ReplicationTransportHandler.class);
List<ReplicationPackage> packages1 = new ArrayList<ReplicationPackage>();
packages1.add(mock(ReplicationPackage.class));
packages1.add(mock(ReplicationPackage.class));
when(handler1.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages1);
subHandlers.add(handler1);
ReplicationTransportHandler handler2 = mock(ReplicationTransportHandler.class);
List<ReplicationPackage> packages2 = new ArrayList<ReplicationPackage>();
packages2.add(mock(ReplicationPackage.class));
packages2.add(mock(ReplicationPackage.class));
packages2.add(mock(ReplicationPackage.class));
when(handler2.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages2);
subHandlers.add(handler2);
MultipleEndpointReplicationTransportHandler multipleEndpointReplicationTransportHandler = new MultipleEndpointReplicationTransportHandler(
subHandlers, TransportEndpointStrategyType.All);
List<ReplicationPackage> replicationPackages = multipleEndpointReplicationTransportHandler.retrievePackages(resourceResolver, replicationRequest);