You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/03/04 09:08:09 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1819: ZOOKEEPER-4467: Format OpCode.addWatch in Request.op2String

maoling commented on a change in pull request #1819:
URL: https://github.com/apache/zookeeper/pull/1819#discussion_r819388705



##########
File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/ToStringTest.java
##########
@@ -37,4 +41,18 @@ public void testJuteToString() {
         assertNotSame("ERROR", req.toString());
     }
 
+    @Test
+    public void testOpCodeToString() throws Exception {
+        Class<?> clazz = ZooDefs.OpCode.class;
+        Field[] fields = clazz.getFields();
+
+        assertNotEquals(0, fields.length);
+
+        for (Field field : fields) {
+            int op_code = field.getInt(null);

Review comment:
       1. Camel-Case. e.g. op_code --> `opCode`
   2. we should assert here `assertEquals(field.getName(), opString)`; ? (Of course we need to modify `createTTL`). When adding a new OpCode, this unit case can tell us: don't forget the method: `Request.op2String`
   
   




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org