Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3211

Drop PrintingVisitor since it does not bring much value

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.11.0
    • None

    Description

      Description

      I noticed that there is a test class PrintingVisitor implements production interface SchemaVisitor to assist testing CloningVisitor. This might not be the best priactice in unit testing and can be improved by leveraging mocking frameworks.

      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.

      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.

      Motivation

      • Decouple test class PrintingVisitor from production interface SchemaVisitor.
      • Remove the redundant test child class PrintingVisitor

      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.

      Attachments

        Activity

          People

            wx930910 Xiao Wang
            wx930910 Xiao Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 50m
                50m