commons-jxpath icon indicating copy to clipboard operation
commons-jxpath copied to clipboard

JXPATH-198: Refactor Context to improve test logic

Open wx930910 opened this issue 4 years ago • 1 comments

JIRA

Fixes XPATH-198

Description

Refactor test class Context


Motivation

  • Decouple test class Context from production interface ExpressionContext.
  • Remove the redundant test child class Context
  • Remove the redundant overridden methods that return default values.
  • Make testing logic more explict.

Key changed/added classes in this PR
  • Created mocking object to replace test subclass Context, decoupled test from production code.
  • Created a method that return the mocking object for reuse purpose.
  • Use method stub to replace method overriding to control mocking object's behavior.
  • Remove redundant overridden methods to improve test logic.
  • Add Mockito dependency.

wx930910 avatar Sep 22 '21 05:09 wx930910

Exact same comment as https://github.com/apache/commons-codec/pull/94#issuecomment-924597345

garydgregory avatar Sep 22 '21 05:09 garydgregory