ElasticsearchIncidentRepository implements IncidentRepository { @Override public Incident getIncidentByCheckId(String checkId) { return elasticsearchClient.getObject(BASE_URL + "/" + getEsId(checkId), Incident.class); } ElasticsearchIncidentRepository(ElasticsearchClient elasticsearchClient); @Override Collection<Incident> getAllIncidents(); @Override Incident getIncidentByCheckId(String checkId); @Override boolean deleteIncident(Incident incident); @Override boolean createIncident(Incident incident); @Override boolean updateIncident(Incident incident); @Override void clear(); static final String BASE_URL; }
@Test public void testGetNonExistingIncindent() throws Exception { assertThat(elasticsearchIncidentRepository.getIncidentByCheckId("test 1")).isNull(); }