@Test
public void getPermutations() {

    List<List<String>> possibilities = Arrays.asList(Arrays.asList("A", "B"), Arrays.asList("C", "D"));
    // bound
    List<List<String>> results = AllocationUtils.getPermutations(possibilities, 4);
    assertEquals(4, results.size());
    assertEquals("[[A, C], [A, D], [B, C], [B, D]]", results.toString());
    results = AllocationUtils.getPermutations(possibilities, 2);
    assertEquals(2, results.size());
    assertEquals("[[A, C], [A, D]]", results.toString());
    // negative max
    results = AllocationUtils.getPermutations(possibilities, -10);
    assertEquals(0, results.size());
    // special case of one element
    possibilities = Collections.singletonList(Arrays.asList("A", "B", "C"));
    results = AllocationUtils.getPermutations(possibilities, Integer.MAX_VALUE);
    assertEquals("[[A], [B], [C]]", results.toString());
}