DataTableUtils { public static boolean areComplementary(List<String> column1, List<String> column2) { if(column1.size() != column2.size()) { return false; } for(int i = 0; i < column1.size(); i++) { String v1 = column1.get(i); String v2 = column2.get(i); if(!v1.trim().isEmpty() && !v2.trim().isEmpty()) { return false; } } return true; } private  DataTableUtils(); static List<DataTable> mergeTablesSpanningMultiplePages(List<DataTable> dataTables); static List<DataTable> mergeComplementaryColumns(List<DataTable> dataTables); static void addBlankColumnsToMatchHeaders(DataTable a, DataTable b); static boolean areComplementary(List<String> column1, List<String> column2);  }
@Test public void areComplementary() { assertThat(DataTableUtils.areComplementary( Arrays.asList("Header", "", " "), Arrays.asList("", "Value1", "Value2") ), is(true)); assertThat(DataTableUtils.areComplementary( Arrays.asList("Header1", "ValueA", ""), Arrays.asList("Header2", "", "Value2") ), is(false)); }