Hello.
The the javadoc on method DiffBuilder.withComparisonFormatter(..) says:
"Sets a non-default formatter for the differences found."
My understanding is that the formatter given there will be used to format the output of all the Difference in the Diff. This is not the case, it is only used by the Diff.toString() but not by all the Differences within the Diff.
I have looked at the code and I have noticed that the "problem" is that the Difference class do not have any construction that allows to change its default formattter, When the Difference are created by class CollectResultsListener in the DiffBuilder, the non default formattter given via DiffBuilder.withComparisonFormatter(..) can not be used to replace the formatter used internally by the Difference object created.
Method Difference.toString() always use the default formatter:
@OverRide
public String toString(){
return toString(new DefaultComparisonFormatter());
}
I think it would be useful to modify the Difference class to allow setting a non default formatter in the constructor and to modify the Difference.toString() method to use it if it is given (same way as it is done for the Diff)
Is it this an issue or is it a designed decision?
If you consider it needs to be changed I could do it myself.
Cheers
Felipe
PS: Thanks for making the enter project. it is very useful :-)
Hello.
The the javadoc on method DiffBuilder.withComparisonFormatter(..) says:
"Sets a non-default formatter for the differences found."
My understanding is that the formatter given there will be used to format the output of all the Difference in the Diff. This is not the case, it is only used by the Diff.toString() but not by all the Differences within the Diff.
I have looked at the code and I have noticed that the "problem" is that the Difference class do not have any construction that allows to change its default formattter, When the Difference are created by class CollectResultsListener in the DiffBuilder, the non default formattter given via DiffBuilder.withComparisonFormatter(..) can not be used to replace the formatter used internally by the Difference object created.
Method Difference.toString() always use the default formatter:
@OverRide
public String toString(){
return toString(new DefaultComparisonFormatter());
}
I think it would be useful to modify the Difference class to allow setting a non default formatter in the constructor and to modify the Difference.toString() method to use it if it is given (same way as it is done for the Diff)
Is it this an issue or is it a designed decision?
If you consider it needs to be changed I could do it myself.
Cheers
Felipe
PS: Thanks for making the enter project. it is very useful :-)