• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xmlunit / xmlunit / cd160610-9b67-4752-a2c4-e3a0d82d991e

21 Apr 2025 11:55AM UTC coverage: 91.756% (-0.02%) from 91.78%
cd160610-9b67-4752-a2c4-e3a0d82d991e

push

circleci

web-flow
Merge pull request #289 from xmlunit/circleci-project-setup

CircleCI project setup

3996 of 4698 branches covered (85.06%)

11754 of 12810 relevant lines covered (91.76%)

2.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/NodeTestException.java
1
/*
2
******************************************************************
3
Copyright (c) 2001-2007,2015,2022 Jeff Martin, Tim Bacon
4
All rights reserved.
5

6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions
8
are met:
9

10
    * Redistributions of source code must retain the above copyright
11
      notice, this list of conditions and the following disclaimer.
12
    * Redistributions in binary form must reproduce the above
13
      copyright notice, this list of conditions and the following
14
      disclaimer in the documentation and/or other materials provided
15
      with the distribution.
16
    * Neither the name of the XMLUnit nor the names
17
      of its contributors may be used to endorse or promote products
18
      derived from this software without specific prior written
19
      permission.
20

21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
POSSIBILITY OF SUCH DAMAGE.
33

34
******************************************************************
35
*/
36

37
package org.custommonkey.xmlunit;
38

39
import org.w3c.dom.Node;
40

41
/**
42
 * Thrown by a NodeTest that fails.
43
 * @see NodeTest
44
 */
45
public class NodeTestException extends Exception {
46
    private transient final Node node;
47

48
    /**
49
     * Constructor for specific node and message
50
     * @param message exception message
51
     * @param node node the failure applies to
52
     */
53
    public NodeTestException(String message, Node node) {
54
        super(message);
1✔
55
        this.node = node;
1✔
56
    }
1✔
57

58
    /**
59
     * Constructor for message only
60
     * @param message exception message
61
     */
62
    public NodeTestException(String message) {
63
        this(message, null);
1✔
64
    }
1✔
65

66
    /**
67
     * @return true if a node was passed to constructor
68
     */
69
    public boolean hasNode() {
70
        return node != null;
1!
71
    }
72

73
    /**
74
     * @return the node passed to constructor, or null if no node was passed
75
     */
76
    public Node getNode() {
77
        return node;
1✔
78
    }
79

80
    /**
81
     * @return the exception message and node information if available
82
     */
83
    @Override
84
    public String getMessage() {
85
        StringBuilder stringBuilder = new StringBuilder(super.getMessage());
1✔
86
        if (hasNode()) {
1!
87
            stringBuilder.append(' ')
×
88
                .append(getNode().toString());
×
89
        }
90
        return stringBuilder.toString();
1✔
91
    }
92
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc