IncidentDao implements IncidentRepository { @Override public @Nullable OpenIncident readOpenIncident(String agentRollupId, AlertCondition condition, AlertSeverity severity) throws Exception { return dataSource.query(new SingleOpenIncident(condition, severity)); } IncidentDao(DataSource dataSource); @Override void insertOpenIncident(String agentRollupId, AlertCondition condition,
            AlertSeverity severity, AlertNotification notification, long openTime); @Override @Nullable OpenIncident readOpenIncident(String agentRollupId, AlertCondition condition,
            AlertSeverity severity); @Override List<OpenIncident> readOpenIncidents(String agentRollupId); @Override List<OpenIncident> readAllOpenIncidents(); @Override void resolveIncident(OpenIncident incident, long resolveTime); @Override List<ResolvedIncident> readResolvedIncidents(long from);  }
@Test public void shouldNotExist() throws Exception { AlertCondition alertCondition = AlertCondition.newBuilder() .setMetricCondition(MetricCondition.newBuilder() .setMetric("transaction:x-percentile") .setTransactionType("Web") .setPercentile(OptionalDouble.newBuilder().setValue(95)) .setThreshold(SECONDS.toNanos(2)) .setTimePeriodSeconds(60) .setMinTransactionCount(100) .build()) .build(); assertThat(incidentDao.readOpenIncident(AGENT_ID, alertCondition, AlertSeverity.HIGH)) .isNull(); }