Skip to content

Commit 773414f

Browse files
authored
HBASE-22791 Fixed order of asserts in TestZKMulti
Signed-off-by: stack <[email protected]> Signed-off-by: Peter Somogyi <[email protected]>
1 parent 32434d1 commit 773414f

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void testSimpleMulti() throws Exception {
112112
LinkedList<ZKUtilOp> singleDelete = new LinkedList<>();
113113
singleDelete.add(ZKUtilOp.deleteNodeFailSilent(path));
114114
ZKUtil.multiOrSequential(zkw, singleDelete, false);
115-
assertEquals(ZKUtil.checkExists(zkw, path), -1);
115+
assertEquals(-1, ZKUtil.checkExists(zkw, path));
116116
}
117117

118118
@Test
@@ -151,8 +151,8 @@ public void testComplexMulti() throws Exception {
151151
Bytes.add(Bytes.toBytes(path1), Bytes.toBytes(path1))));
152152
assertTrue(Bytes.equals(ZKUtil.getData(zkw, path2),
153153
Bytes.add(Bytes.toBytes(path2), Bytes.toBytes(path2))));
154-
assertEquals(ZKUtil.checkExists(zkw, path3), -1);
155-
assertEquals(ZKUtil.checkExists(zkw, path4), -1);
154+
assertEquals(-1, ZKUtil.checkExists(zkw, path3));
155+
assertEquals(-1, ZKUtil.checkExists(zkw, path4));
156156
assertTrue(Bytes.equals(ZKUtil.getData(zkw, path5), Bytes.toBytes(path5)));
157157
assertTrue(Bytes.equals(ZKUtil.getData(zkw, path6), Bytes.toBytes(path6)));
158158
}
@@ -213,9 +213,9 @@ public void testSingleFailureInMulti() throws Exception {
213213
}
214214
assertTrue(caughtNoNode);
215215
// assert that none of the operations succeeded
216-
assertEquals(ZKUtil.checkExists(zkw, pathA), -1);
217-
assertEquals(ZKUtil.checkExists(zkw, pathB), -1);
218-
assertEquals(ZKUtil.checkExists(zkw, pathC), -1);
216+
assertEquals(-1, ZKUtil.checkExists(zkw, pathA));
217+
assertEquals(-1, ZKUtil.checkExists(zkw, pathB));
218+
assertEquals(-1, ZKUtil.checkExists(zkw, pathC));
219219
}
220220

221221
@Test
@@ -246,11 +246,11 @@ public void testMultiFailure() throws Exception {
246246
}
247247
assertTrue(caughtNodeExists);
248248
// check that no modifications were made
249-
assertNotEquals(ZKUtil.checkExists(zkw, pathX), -1);
250-
assertEquals(ZKUtil.checkExists(zkw, pathY), -1);
251-
assertEquals(ZKUtil.checkExists(zkw, pathZ), -1);
252-
assertEquals(ZKUtil.checkExists(zkw, pathW), -1);
253-
assertEquals(ZKUtil.checkExists(zkw, pathV), -1);
249+
assertNotEquals(-1, ZKUtil.checkExists(zkw, pathX));
250+
assertEquals(-1, ZKUtil.checkExists(zkw, pathY));
251+
assertEquals(-1, ZKUtil.checkExists(zkw, pathZ));
252+
assertEquals(-1, ZKUtil.checkExists(zkw, pathW));
253+
assertEquals(-1, ZKUtil.checkExists(zkw, pathV));
254254

255255
// test that with multiple failures, throws an exception corresponding to first failure in list
256256
ops = new LinkedList<>();
@@ -265,11 +265,11 @@ public void testMultiFailure() throws Exception {
265265
}
266266
assertTrue(caughtNoNode);
267267
// check that no modifications were made
268-
assertNotEquals(ZKUtil.checkExists(zkw, pathX), -1);
269-
assertEquals(ZKUtil.checkExists(zkw, pathY), -1);
270-
assertEquals(ZKUtil.checkExists(zkw, pathZ), -1);
271-
assertEquals(ZKUtil.checkExists(zkw, pathW), -1);
272-
assertEquals(ZKUtil.checkExists(zkw, pathV), -1);
268+
assertNotEquals(-1, ZKUtil.checkExists(zkw, pathX));
269+
assertEquals(-1, ZKUtil.checkExists(zkw, pathY));
270+
assertEquals(-1, ZKUtil.checkExists(zkw, pathZ));
271+
assertEquals(-1, ZKUtil.checkExists(zkw, pathW));
272+
assertEquals(-1, ZKUtil.checkExists(zkw, pathV));
273273
}
274274

275275
@Test
@@ -296,9 +296,9 @@ public void testRunSequentialOnMultiFailure() throws Exception {
296296
ZKUtil.multiOrSequential(zkw, ops, true);
297297
assertTrue(Bytes.equals(ZKUtil.getData(zkw, path1),
298298
Bytes.add(Bytes.toBytes(path1), Bytes.toBytes(path1))));
299-
assertEquals(ZKUtil.checkExists(zkw, path2), -1);
300-
assertEquals(ZKUtil.checkExists(zkw, path3), -1);
301-
assertNotEquals(ZKUtil.checkExists(zkw, path4), -1);
299+
assertEquals(-1, ZKUtil.checkExists(zkw, path2));
300+
assertEquals(-1, ZKUtil.checkExists(zkw, path3));
301+
assertNotEquals(-1, ZKUtil.checkExists(zkw, path4));
302302
}
303303

304304
/**
@@ -329,7 +329,7 @@ public void testDeleteNodeRecursivelyMulti() throws Exception {
329329
createZNodeTree(parentZNode);
330330

331331
ZKUtil.deleteNodeRecursively(zkw, parentZNode);
332-
assertEquals("Parent znode should be deleted.", ZKUtil.checkExists(zkw, parentZNode), -1);
332+
assertEquals("Parent znode should be deleted.", -1, ZKUtil.checkExists(zkw, parentZNode));
333333
}
334334

335335
@Test
@@ -343,9 +343,9 @@ public void testDeleteNodeRecursivelyMultiOrSequential() throws Exception {
343343

344344
ZKUtil.deleteNodeRecursivelyMultiOrSequential(zkw, false, parentZNode1, parentZNode2,
345345
parentZNode3);
346-
assertEquals("Parent znode 1 should be deleted.", ZKUtil.checkExists(zkw, parentZNode1), -1);
347-
assertEquals("Parent znode 2 should be deleted.", ZKUtil.checkExists(zkw, parentZNode2), -1);
348-
assertEquals("Parent znode 3 should be deleted.", ZKUtil.checkExists(zkw, parentZNode3), -1);
346+
assertEquals("Parent znode 1 should be deleted.", -1, ZKUtil.checkExists(zkw, parentZNode1));
347+
assertEquals("Parent znode 2 should be deleted.", -1, ZKUtil.checkExists(zkw, parentZNode2));
348+
assertEquals("Parent znode 3 should be deleted.", -1, ZKUtil.checkExists(zkw, parentZNode3));
349349
}
350350

351351
@Test

0 commit comments

Comments
 (0)