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

hazendaz / httpunit / 636

05 Dec 2025 03:27AM UTC coverage: 80.509%. Remained the same
636

push

github

hazendaz
Cleanup more old since tags

you guessed it, at this point going to jautodoc the rest so the warnings on builds go away ;)

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8249 of 10132 relevant lines covered (81.42%)

0.81 hits per line

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

98.11
/src/main/java/com/meterware/httpunit/dom/HTMLElementImpl.java
1
/*
2
 * MIT License
3
 *
4
 * Copyright 2011-2025 Russell Gold
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
9
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
 *
11
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions
12
 * of the Software.
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
15
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
17
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
 * DEALINGS IN THE SOFTWARE.
19
 */
20
package com.meterware.httpunit.dom;
21

22
import org.w3c.dom.Attr;
23
import org.w3c.dom.NodeList;
24
import org.w3c.dom.html.HTMLElement;
25

26
public class HTMLElementImpl extends ElementImpl implements HTMLElement {
1✔
27

28
    private static final long serialVersionUID = 1L;
29
    public static final String UNSPECIFIED_ATTRIBUTE = null;
1✔
30

31
    ElementImpl create() {
32
        return new HTMLElementImpl();
1✔
33
    }
34

35
    public void click() {
36
        doClickAction();
1✔
37
    }
1✔
38

39
    public void doClickAction() {
40
    }
×
41

42
    @Override
43
    public String getId() {
44
        return getAttributeWithNoDefault("id");
1✔
45
    }
46

47
    @Override
48
    public void setId(String id) {
49
        setAttribute("id", id);
1✔
50
    }
1✔
51

52
    @Override
53
    public String getTitle() {
54
        return getAttributeWithNoDefault("title");
1✔
55
    }
56

57
    @Override
58
    public void setTitle(String title) {
59
        setAttribute("title", title);
1✔
60
    }
1✔
61

62
    @Override
63
    public String getLang() {
64
        return getAttributeWithNoDefault("lang");
1✔
65
    }
66

67
    @Override
68
    public void setLang(String lang) {
69
        setAttribute("lang", lang);
1✔
70
    }
1✔
71

72
    @Override
73
    public String getDir() {
74
        return getAttributeWithNoDefault("dir");
1✔
75
    }
76

77
    @Override
78
    public void setDir(String dir) {
79
        setAttribute("dir", dir);
1✔
80
    }
1✔
81

82
    @Override
83
    public String getClassName() {
84
        return getAttributeWithNoDefault("class");
1✔
85
    }
86

87
    @Override
88
    public void setClassName(String className) {
89
        setAttribute("class", className);
1✔
90
    }
1✔
91

92
    @Override
93
    public NodeList getElementsByTagName(String name) {
94
        return super.getElementsByTagName(((HTMLDocumentImpl) getOwnerDocument()).toNodeCase(name));
1✔
95
    }
96

97
    // ---------------------------------------------- protected methods
98
    // -----------------------------------------------------
99

100
    protected final String getAttributeWithDefault(String attributeName, String defaultValue) {
101
        if (hasAttribute(attributeName)) {
1✔
102
            return getAttribute(attributeName);
1✔
103
        }
104
        return defaultValue;
1✔
105
    }
106

107
    protected final String getAttributeWithNoDefault(String attributeName) {
108
        if (hasAttribute(attributeName)) {
1✔
109
            return getAttribute(attributeName);
1✔
110
        }
111
        return UNSPECIFIED_ATTRIBUTE;
1✔
112
    }
113

114
    protected boolean getBooleanAttribute(String name) {
115
        Attr attr = getAttributeNode(name);
1✔
116
        return attr != null && !attr.getValue().equalsIgnoreCase("false");
1✔
117
    }
118

119
    protected int getIntegerAttribute(String name) {
120
        String value = getAttribute(name);
1✔
121
        return value.isEmpty() ? 0 : Integer.parseInt(value);
1✔
122
    }
123

124
    protected int getIntegerAttribute(String name, int defaultValue) {
125
        String value = getAttribute(name);
1✔
126
        return value.isEmpty() ? defaultValue : Integer.parseInt(value);
1✔
127
    }
128

129
    protected void setAttribute(String name, boolean disabled) {
130
        setAttribute(name, disabled ? "true" : "false");
1✔
131
    }
1✔
132

133
    protected void setAttribute(String name, int value) {
134
        setAttribute(name, Integer.toString(value));
1✔
135
    }
1✔
136

137
    HTMLDocumentImpl getHtmlDocument() {
138
        return (HTMLDocumentImpl) getOwnerDocument();
1✔
139
    }
140

141
}
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

© 2026 Coveralls, Inc