private static Optional<Map<String, Integer>> mergeCounts(ImportResult ir1, ImportResult ir2) {
    if (ir1.counts.isPresent() && ir2.counts.isPresent()) {
      Map<String, Integer> map = new HashMap<>(ir1.counts.get());
      ir2.counts.get().forEach((k, v) -> map.merge(k, v, Integer::sum));
      return Optional.of(map);
    } else {
      return ir1.counts.isPresent() ? ir1.counts : ir2.counts;
    }
  }
@Test
  public void mergeCounts() {
    ImportResult ir1 = OK.copyWithCounts(Map.of("A", 10, "B", 10));
    ImportResult ir2 = OK.copyWithCounts(Map.of("A", 5, "C", 5));
    ImportResult exp = OK.copyWithCounts(Map.of("A", 15, "B", 10, "C", 5));
    assertEquals(exp, ImportResult.merge(ir1, ir2));
  }