public class WritingXmlValidator extends Object
Modifier and Type | Field and Description |
---|---|
static String |
controlFileSource
The default relative path to write control-files to when
writeXml is true (default:
src/test/resources/ ). |
static boolean |
logXml
Set to
true to log the actual XML document (parsed from an JAXB object or a String ) when
validating (default false ). |
static boolean |
writeXml
|
Constructor and Description |
---|
WritingXmlValidator() |
Modifier and Type | Method and Description |
---|---|
static void |
validateXml(BaseObject object,
String controlFile)
Validates that the document represented by
object is equal to the document parsed from the
controlFile . |
static void |
validateXml(BaseObject object,
String controlFile,
DifferenceListener differenceListener)
Validates that the document represented by
object is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
File controlFile,
boolean trimComment,
DifferenceListener differenceListener)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
File controlFile,
DifferenceListener differenceListener)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
String controlFile)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
String controlFile,
boolean trimComment)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
String controlFile,
boolean trimComment,
DifferenceListener differenceListener)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static void |
validateXml(String result,
String controlFile,
DifferenceListener differenceListener)
Validates that the document represented by
result is equal to the document parsed from the
controlFile . |
static File |
writeToDisk(Object data,
String name)
Writes the document represented by
data to a File . |
static File |
writeToDiskPlain(String data,
String name)
Writes the document represented by
data to a File . |
public static boolean writeXml
public static boolean logXml
true
to log the actual XML document (parsed from an JAXB object or a String
) when
validating (default false
).public static File writeToDisk(Object data, String name) throws IOException
data
to a File
.data
- a JAXB object from package org.appng.xml.platform
name
- the path to the file (relative to controlFileSource
)File
IOException
- if an I/O error occurs while writing the filepublic static File writeToDiskPlain(String data, String name) throws IOException
data
to a File
.data
- a XML stringname
- the path to the file (relative to controlFileSource
)File
IOException
- if an I/O error occurs while writing the filepublic static void validateXml(BaseObject object, String controlFile) throws IOException
object
is equal to the document parsed from the
controlFile
.object
- a JAXB object from package org.appng.xml.platform
controlFile
- the path to the control file (relative to the classpath)IOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(BaseObject object, String controlFile, DifferenceListener differenceListener) throws IOException
object
is equal to the document parsed from the
controlFile
.object
- a JAXB object from package org.appng.xml.platform
controlFile
- the path to the control file (relative to the classpath)differenceListener
- an optional DifferenceListener
that is applied when building the Diff
between the documentsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, String controlFile) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the path to the control file (relative to the classpath)IOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, String controlFile, DifferenceListener differenceListener) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the path to the control file (relative to the classpath)differenceListener
- an optional DifferenceListener
that is applied when building the Diff
between the documentsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, File controlFile, DifferenceListener differenceListener) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the control filedifferenceListener
- an optional DifferenceListener
that is applied when building the Diff
between the documentsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, String controlFile, boolean trimComment) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the path to the control file (relative to the classpath)trimComment
- set to true
to un-comment previously commented elementsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, String controlFile, boolean trimComment, DifferenceListener differenceListener) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the path to the control file (relative to the classpath)trimComment
- set to true
to un-comment previously commented elementsdifferenceListener
- an optional DifferenceListener
that is applied when building the Diff
between the documentsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failspublic static void validateXml(String result, File controlFile, boolean trimComment, DifferenceListener differenceListener) throws IOException
result
is equal to the document parsed from the
controlFile
.result
- a XML stringcontrolFile
- the control filetrimComment
- set to true
to un-comment previously commented elementsdifferenceListener
- an optional DifferenceListener
that is applied when building the Diff
between the documentsIOException
- if an I/O error occurs while validatingAssertionError
- if the validation failsCopyright © 2011–2021 aiticon GmbH. All rights reserved.