Java Code Examples for org.xmlunit.builder.DiffBuilder#build()
The following examples show how to use
org.xmlunit.builder.DiffBuilder#build() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaceholderDifferenceEvaluatorTest.java From xmlunit with Apache License 2.0 | 6 votes |
@Test public void hasMatchesRegexPlaceholder_Element_Exception_MalformedRegex() { String control = "<elem1>${xmlunit.matchesRegex[^(\\d+$]}</elem1>"; String test = "<elem1>23abc</elem1>"; DiffBuilder diffBuilder = DiffBuilder.compare(control).withTest(test) .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(null, null, Pattern.quote("["), Pattern.quote("]"), null)); try { diffBuilder.build(); fail(); } catch (XMLUnitException e) { assertThat(e.getCause().getMessage(), containsString("Unclosed group near index")); } }
Example 2
Source File: PlaceholderDifferenceEvaluatorTest.java From xmlunit with Apache License 2.0 | 5 votes |
@Test public void hasIgnorePlaceholder_Exception_ExclusivelyOccupy() throws Exception { String control = "<elem1><elem11> ${xmlunit.ignore}abc</elem11></elem1>"; String test = "<elem1><elem11>abc</elem11></elem1>"; DiffBuilder diffBuilder = DiffBuilder.compare(control).withTest(test) .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()); try { diffBuilder.build(); fail(); } catch (XMLUnitException e) { assertEquals("The placeholder must exclusively occupy the text node.", e.getCause().getMessage()); } }
Example 3
Source File: PlaceholderDifferenceEvaluatorTest.java From xmlunit with Apache License 2.0 | 5 votes |
@Test public void hasIgnorePlaceholder_Attribute_Exception_ExclusivelyOccupy() throws Exception { String control = "<elem1 attr='${xmlunit.ignore}abc'/>"; String test = "<elem1 attr='abc'/>"; DiffBuilder diffBuilder = DiffBuilder.compare(control).withTest(test) .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()); try { diffBuilder.build(); fail(); } catch (XMLUnitException e) { assertEquals("The placeholder must exclusively occupy the text node.", e.getCause().getMessage()); } }