Skip to content

Potential improvement: A wrapper constructor for class Comparison #279

@hiufung-kwok

Description

@hiufung-kwok

At the moment there is only one constructor available for Comparsion class:

public Comparison(ComparisonType t,
                      Node controlTarget, String controlXPath, Object controlValue, String controlParentXPath,
                      Node testTarget, String testXPath, Object testValue, String testParentXPath) {

And this is being used extensively throughout the DOMDifferenceEngine class, however given the fact there are 9 arguments in total for the constructor and this being called multiple times.
It's causing readability on my opinion when I tried to understand the logic of DOMDifferenceEngine.

Hence I'm proposing instead of reading controlXPath and controlParentXPath in separately in String form, we can actually create another constructor as the wrapper to produce these two values from a given XPathContext instance, since both are derived fields.

The objective of this issue / PR is to create constructor similar to the following:

public Comparison(ComparisonType t,
                      XPathContext controlContext, Node controlTarget, Object controlValue,
                      XPathContext testContext, Node testTarget, Object testValue) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions