@Test
public void test() {

    ContingenciesProvider provider = n -> IntStream.range(1, 5)
            .mapToObj(i -> new Contingency("contingency-" + i))
            .collect(Collectors.toList());
    Network network = Mockito.mock(Network.class);
    List<String> subList1 = new SubContingenciesProvider(provider, new Partition(1, 2))
            .getContingencies(network)
            .stream().map(Contingency::getId).collect(Collectors.toList());
    List<String> subList2 = new SubContingenciesProvider(provider, new Partition(2, 2))
            .getContingencies(network)
            .stream().map(Contingency::getId).collect(Collectors.toList());
    assertEquals(ImmutableList.of("contingency-1", "contingency-2"), subList1);
    assertEquals(ImmutableList.of("contingency-3", "contingency-4"), subList2);
}