diff --git a/src/main/java/org/elasticsearch/alerts/AlertsStore.java b/src/main/java/org/elasticsearch/alerts/AlertsStore.java index afe4eafa12d..f4b991f5a5a 100644 --- a/src/main/java/org/elasticsearch/alerts/AlertsStore.java +++ b/src/main/java/org/elasticsearch/alerts/AlertsStore.java @@ -112,11 +112,17 @@ public class AlertsStore extends AbstractComponent { alert.version(response.getVersion()); // Don'<> need to update the alertMap, since we are working on an instance from it. - assert alertMap.get(alert.alertName()) == alert; + assert verifySameInstance(alert); return response; } + private boolean verifySameInstance(Alert alert) { + Alert found = alertMap.get(alert.alertName()); + assert found == alert : "expected " + alert + " but got" + found; + return true; + } + /** * Deletes the alert with the specified name if exists */