void (List<Data> datas, List<Area> areas, int... values) { List<Pair<Data, Area>> result = new ArrayList<>(); StepIntersection.processIntersections(datas, areas, it -> it.getTextRange(), it -> it.getTextRange(), (data, area) -> result.add(Pair.create(data, area))); assert values.length % 2 == 0; assertEquals(values.length / 2, result.size()); for (int i = 0; i < values.length / 2; i++) { Pair<Integer, Integer> expected = Pair.create(values[2 * i], values[2 * i + 1]); Pair<Integer, Integer> actual = Pair.create(result.get(i).first.index, result.get(i).second.index); assertEquals(expected, actual); } }