[
https://issues.apache.org/jira/browse/AVRO-3211?focusedWorklogId=654483&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-654483
]
ASF GitHub Bot logged work on AVRO-3211:
----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Sep/21 12:09
Start Date: 23/Sep/21 12:09
Worklog Time Spent: 10m
Work Description: martin-g commented on pull request #1341:
URL: https://github.com/apache/avro/pull/1341#issuecomment-925750713
> What do you think about just dropping PrintingVisitor entirely?
+1
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 654483)
Remaining Estimate: 0h
Time Spent: 10m
> Refactor PrintingVisitor to improve test design
> -----------------------------------------------
>
> Key: AVRO-3211
> URL: https://issues.apache.org/jira/browse/AVRO-3211
> Project: Apache Avro
> Issue Type: Improvement
> Reporter: Xiao Wang
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> h3. Description
> I noticed that there is a test class
> [PrintingVisitor|https://github.com/apache/avro/blob/42822886c28ea74a744abb7e7a80a942c540faa5/lang/java/compiler/src/test/java/org/apache/avro/compiler/schema/TestSchemas.java#L41]
> implements production interface
> [SchemaVisitor|https://github.com/apache/avro/blob/42822886c28ea74a744abb7e7a80a942c540faa5/lang/java/compiler/src/main/java/org/apache/avro/compiler/schema/SchemaVisitor.java#L22]
> to assist testing
> [CloningVisitor|https://github.com/apache/avro/blob/42822886c28ea74a744abb7e7a80a942c540faa5/lang/java/compiler/src/main/java/org/apache/avro/compiler/schema/CloningVisitor.java#L33].
> This might not be the best priactice in unit testing and can be improved by
> leveraging mocking frameworks.
> h3. Current Implementation
> * {{PrintingVisitor}} implements {{SchemaVisitor}} and implements methods.
> * In test case, the child test class is used to assit testing by logging out
> method excution information.
> h3. Proposed Implementation
> * Replace {{PrintingVisitor}} with a mocking object created by Mockito.
> * Use method stub to control the behavior of the mocking object and logging
> information.
> * Create a method to return the mocking object for reusing.
> h3. Motivation
> * Decouple test class {{PrintingVisitor}} from production interface
> {{SchemaVisitor}}.
> * Remove the redundant test child class {{PrintingVisitor}}
> h3. More Thought
> * If we only use {{PrintingVisitor}} to log out information, we can actually
> get rid of PrintingVisitor and spy CloningVisitor, then use Mockito.verify()
> to verify method execution times and order based on the given Schema.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)