anmolnar commented on a change in pull request #839: ZOOKEEPER-3290: Throw
detailed KeeperException when a transaction failed
URL: https://github.com/apache/zookeeper/pull/839#discussion_r279003398
##########
File path:
zookeeper-server/src/test/java/org/apache/zookeeper/test/MultiTransactionTest.java
##########
@@ -154,8 +154,17 @@ public void processResult(int rc, String path, Object ctx,
zk.multi(ops);
Assert.fail("Shouldn't have validated in ZooKeeper client!");
} catch (KeeperException e) {
- Assert.assertEquals("Wrong exception", expectedErr, e.code()
- .name());
+ String[] codeAndPath = expectedErr.split("@");
+ if (codeAndPath.length < 1 || codeAndPath.length > 2) {
+ Assert.fail("Invalid exceptedErr=" + expectedErr);
+ }
+ Assert.assertEquals("Wrong exception", codeAndPath[0],
Review comment:
You shouldn't check for string match if you can access the actual type.
Please use `assertThat(..., instanceOf(...))` or `assertThat(..., isA(...))`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services