@Test
public void testAddOrUpdateVulnerabilityAndSetIdNewVulnerability() throws Exception {

    Vulnerability v1 = new Vulnerability().setId("idv1").setExternalId("eid");
    when(vulnerabilityDatabaseHandler.getByExternalId(Vulnerability.class, "eid")).thenReturn(null);
    when(vulnerabilityDatabaseHandler.add(v1)).thenReturn(RequestStatus.SUCCESS);
    Map<UpdateType, List<Vulnerability>> resultMap = vulnerabilityConnector.addOrUpdateVulnerabilityAndSetId(v1, statusToVulnerabilityMap);
    assertThat(resultMap.get(UpdateType.NEW).get(0).getId(), is("idv1"));
    assertThat(resultMap.get(UpdateType.OLD), is(Collections.EMPTY_LIST));
    assertThat(resultMap.get(UpdateType.UPDATED), is(Collections.EMPTY_LIST));
    assertThat(resultMap.get(UpdateType.FAILED), is(Collections.EMPTY_LIST));
}