wish help you to fix your issue Do the "replace" normalization using an XSLT transformation, then use the XPath 2.0 deep-equal() function (perhaps within the same transformation) to do the comparison with reference results. This enables proper XML comparison semantics, e.g. ignoring insignificant whitespace, or arbitrary distinctions such as single-versus-double quotes.
will be helpful for those in need It's probably better to use Java 8's LocalDate, since Calendar also represents time. In your example, calendar1 and calendar2 would have slightly different times, since you let them default. If you are using an earlier version of Java, you can use the Joda date library instead.
In Java which approach for reading files by bytes is better: