@Test
public void testTooLarge() throws Exception {

  final int PRODUCT_ELEMENTS = 100;
  
  List<List<String>> l = new ArrayList<List<String>>();
  for (int i=0;i<PRODUCT_ELEMENTS;++i) {
    List<String> s1 = new ArrayList<String>();
    s1.add("a");
    s1.add("b");
    l.add(s1);
  }
  
  try {
    CartesianProduct.cartesianProduct(l);
    // Will probably never get here since we will run out of memory
    fail("Expected exception");
  } catch(Exception ex) {
    assertTrue(ex.getMessage().contains(BigInteger.valueOf(2).pow(PRODUCT_ELEMENTS).toString()));
  }
}