/** * If {@link XMLUnit#getIgnoreWhitespace whitespace is ignored} in * differences then manipulate the content to strip the redundant * whitespace * @param originalDoc a document making up one half of this difference * @return the original document with redundant whitespace removed if * differences ignore whitespace */ private Document getWhitespaceManipulatedDocument(Document originalDoc) { return XMLUnit.getIgnoreWhitespace() ? XMLUnit.getWhitespaceStrippedDocument(originalDoc) : originalDoc; }
/** * If {@link XMLUnit#getIgnoreWhitespace whitespace is ignored} in * differences then manipulate the content to strip the redundant * whitespace * @param originalDoc a document making up one half of this difference * @return the original document with redundant whitespace removed if * differences ignore whitespace */ private Document getWhitespaceManipulatedDocument(Document originalDoc) { return XMLUnit.getIgnoreWhitespace() ? XMLUnit.getWhitespaceStrippedDocument(originalDoc) : originalDoc; }
protected Diff createDiff(Document controlDocument, Document messageDocument) { if (ignoreWhitespace != XMLUnit.getIgnoreWhitespace()) { XMLUnit.setIgnoreWhitespace(ignoreWhitespace); } return new EnhancedDiff(controlDocument, messageDocument); }
/** * Test two non-null values for inequality * @param expected * @param actual * @return TRUE if the values are not equals() equal (taking whitespace * into account if necessary) */ private boolean unequalNotNull(Object expected, Object actual) { if ((XMLUnit.getIgnoreWhitespace() || XMLUnit.getNormalizeWhitespace()) && expected instanceof String && actual instanceof String) { String expectedString = ((String) expected).trim(); String actualString = ((String) actual).trim(); if (XMLUnit.getNormalizeWhitespace()) { expectedString = normalizeWhitespace(expectedString); actualString = normalizeWhitespace(actualString); } return !expectedString.equals(actualString); } return !(expected.equals(actual)); }
/** * Test two non-null values for inequality * @param expected * @param actual * @return TRUE if the values are not equals() equal (taking whitespace * into account if necessary) */ private boolean unequalNotNull(Object expected, Object actual) { if ((XMLUnit.getIgnoreWhitespace() || XMLUnit.getNormalizeWhitespace()) && expected instanceof String && actual instanceof String) { String expectedString = ((String) expected).trim(); String actualString = ((String) actual).trim(); if (XMLUnit.getNormalizeWhitespace()) { expectedString = normalizeWhitespace(expectedString); actualString = normalizeWhitespace(actualString); } return !expectedString.equals(actualString); } return !(expected.equals(actual)); }
ctrlSource = new WhitespaceNormalizedSource(ctrlSource); tstSource = new WhitespaceNormalizedSource(tstSource); } else if (XMLUnit.getIgnoreWhitespace()) { ctrlSource = new WhitespaceStrippedSource(ctrlSource); tstSource = new WhitespaceStrippedSource(tstSource);