fix unit test shouldAllowToQueryAfterThreadDied
Ensure only one thread dies, not both.
Author: Eno Thereska
Reviewers: Damian Guy
Closes from enothereska/hotfix-queryable-state
@@ -728,10 +728,11 @@ public class QueryableStateIntegrationTest {
.reduce(new Reducer<String>() {
@Override
public String apply(final String value1, final String value2) {
- if (beforeFailure.get() && value1.length() > 1) {
- beforeFailure.set(false);
+ if (value1.length() > 1) {
+ if (beforeFailure.compareAndSet(true, false)) {
throw new RuntimeException("Injected test exception");
}
+ }
return value1 + value2;
}
}, storeName)
