@Test public void r1_r2_merged_contains_all_findings() { SecHubResult r1 = new SecHubResult(); SecHubFinding finding1 = new SecHubFinding(); r1.getFindings().add(finding1); SecHubFinding finding2 = new SecHubFinding(); SecHubResult r2 = new SecHubResult(); r2.getFindings().add(finding2); SecHubResult merged = mergerToTest.merge(r1, r2); List<SecHubFinding> findings = merged.getFindings(); assertEquals(2, findings.size()); assertTrue(findings.contains(finding1)); assertTrue(findings.contains(finding2)); }
public SecHubResult merge(SecHubResult result1, SecHubResult result2) { if (result1==null) { return result2; } if (result2==null) { return result1; } SecHubResult merged = new SecHubResult(); mergeFindings(result1, merged); mergeFindings(result2, merged); mergeFalsePositives(result1, merged); mergeFalsePositives(result2, merged); merged.setCount(result1.getCount()+result2.getCount()); return merged; }
SecHubResultMerger { public SecHubResult merge(SecHubResult result1, SecHubResult result2) { if (result1==null) { return result2; } if (result2==null) { return result1; } SecHubResult merged = new SecHubResult(); mergeFindings(result1, merged); mergeFindings(result2, merged); mergeFalsePositives(result1, merged); mergeFalsePositives(result2, merged); merged.setCount(result1.getCount()+result2.getCount()); return merged; } }
SecHubResultMerger { public SecHubResult merge(SecHubResult result1, SecHubResult result2) { if (result1==null) { return result2; } if (result2==null) { return result1; } SecHubResult merged = new SecHubResult(); mergeFindings(result1, merged); mergeFindings(result2, merged); mergeFalsePositives(result1, merged); mergeFalsePositives(result2, merged); merged.setCount(result1.getCount()+result2.getCount()); return merged; }  }
SecHubResultMerger { public SecHubResult merge(SecHubResult result1, SecHubResult result2) { if (result1==null) { return result2; } if (result2==null) { return result1; } SecHubResult merged = new SecHubResult(); mergeFindings(result1, merged); mergeFindings(result2, merged); mergeFalsePositives(result1, merged); mergeFalsePositives(result2, merged); merged.setCount(result1.getCount()+result2.getCount()); return merged; }  SecHubResult merge(SecHubResult result1, SecHubResult result2); }
SecHubResultMerger { public SecHubResult merge(SecHubResult result1, SecHubResult result2) { if (result1==null) { return result2; } if (result2==null) { return result1; } SecHubResult merged = new SecHubResult(); mergeFindings(result1, merged); mergeFindings(result2, merged); mergeFalsePositives(result1, merged); mergeFalsePositives(result2, merged); merged.setCount(result1.getCount()+result2.getCount()); return merged; }  SecHubResult merge(SecHubResult result1, SecHubResult result2);  }