You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2021/09/19 19:45:36 UTC

[GitHub] [avro] wx930910 commented on a change in pull request #1341: refactor printinVisitor to improve testing logic

wx930910 commented on a change in pull request #1341:
URL: https://github.com/apache/avro/pull/1341#discussion_r711793508



##########
File path: lang/java/compiler/pom.xml
##########
@@ -228,6 +228,11 @@
       <!-- can only be used from within ant -->
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>${mockito.version}</version>

Review comment:
       Yes, I'll limit the Mockito within test scope.

##########
File path: lang/java/compiler/src/test/java/org/apache/avro/compiler/schema/TestSchemas.java
##########
@@ -38,36 +59,11 @@
       + "                     {\"name\":\"methodName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}\n"
       + "                  ]}},\n" + "              {\"name\":\"node\",\"type\":\"SampleNode\"}]}}}" + "]}";
 
-  private static class PrintingVisitor implements SchemaVisitor {
-
-    @Override
-    public SchemaVisitorAction visitTerminal(Schema terminal) {
-      System.out.println("Terminal: " + terminal.getFullName());
-      return SchemaVisitorAction.CONTINUE;
-    }
-
-    @Override
-    public SchemaVisitorAction visitNonTerminal(Schema terminal) {
-      System.out.println("NONTerminal start: " + terminal.getFullName());
-      return SchemaVisitorAction.CONTINUE;
-    }
-
-    @Override
-    public SchemaVisitorAction afterVisitNonTerminal(Schema terminal) {
-      System.out.println("NONTerminal end: " + terminal.getFullName());
-      return SchemaVisitorAction.CONTINUE;
-    }
-
-    @Override
-    public Object get() {
-      return null;
-    }

Review comment:
       Yes, actually if we only want to confirm the execution order of the visitor, we can just spy on `CloningVisitor` and totaly get rid of the `printingVisitor`, do you think that will be better?




-- 
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: issues-unsubscribe@avro.apache.org

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