improve assert

Original commit: elastic/x-pack-elasticsearch@cfedeb5da8
This commit is contained in:
Martijn van Groningen 2014-11-24 21:27:14 +01:00
parent 7eb1ec8ba0
commit 98bb60e4ba
1 changed files with 7 additions and 1 deletions

View File

@ -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
*/