PrintPattern { public static List<List<Integer>> getPattern(int size) { List<List<Integer>> result = new ArrayList<>(); if (size == 0) return result; result.add(Arrays.asList(1)); for (int i = 0; i < size - 1; i++) { List<Integer> prev = result.get(result.size() - 1); result.add(generatePattern(prev)); } return result; }  static List<List<Integer>> getPattern(int size); static String countAndSay(int n);  }
@Test(dataProvider = "patternDP") public void Test(int line, List<Integer> expected) { assertEquals(PrintPattern.getPattern(line), expected); }