improve assert
Original commit: elastic/x-pack-elasticsearch@cfedeb5da8
This commit is contained in:
parent
7eb1ec8ba0
commit
98bb60e4ba
|
@ -112,11 +112,17 @@ public class AlertsStore extends AbstractComponent {
|
||||||
alert.version(response.getVersion());
|
alert.version(response.getVersion());
|
||||||
|
|
||||||
// Don'<></> need to update the alertMap, since we are working on an instance from it.
|
// 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;
|
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
|
* Deletes the alert with the specified name if exists
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue