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

hazendaz / httpunit / 656

06 Dec 2025 09:11PM UTC coverage: 80.452% (+0.02%) from 80.435%
656

push

github

hazendaz
[maven-release-plugin] prepare for next development iteration

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10137 relevant lines covered (81.34%)

0.81 hits per line

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

60.0
/src/main/java/com/meterware/httpunit/TextBlock.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;
21

22
import java.net.URL;
23
import java.util.ArrayList;
24

25
import org.w3c.dom.Node;
26

27
/**
28
 * A class which represents a block of text in a web page. Experimental.
29
 **/
30
public class TextBlock extends BlockElement {
31

32
    /** The lists. */
33
    private ArrayList _lists = new ArrayList<>();
1✔
34
    /** Predicate to match part or all of a block's class attribute. **/
35
    public static final HTMLElementPredicate MATCH_CLASS;
36
    /** Predicate to match the tag associated with a block (case insensitive). **/
37
    public static final HTMLElementPredicate MATCH_TAG;
38

39
    /**
40
     * Instantiates a new text block.
41
     *
42
     * @param response
43
     *            the response
44
     * @param frame
45
     *            the frame
46
     * @param baseURL
47
     *            the base URL
48
     * @param baseTarget
49
     *            the base target
50
     * @param rootNode
51
     *            the root node
52
     * @param characterSet
53
     *            the character set
54
     */
55
    public TextBlock(WebResponse response, FrameSelector frame, URL baseURL, String baseTarget, Node rootNode,
56
            String characterSet) {
57
        super(response, frame, baseURL, baseTarget, rootNode, characterSet);
1✔
58
    }
1✔
59

60
    /**
61
     * Returns any lists embedded in this text block.
62
     *
63
     * @return the lists
64
     */
65
    public WebList[] getLists() {
66
        return (WebList[]) _lists.toArray(new WebList[_lists.size()]);
×
67
    }
68

69
    /**
70
     * Adds the list.
71
     *
72
     * @param webList
73
     *            the web list
74
     */
75
    void addList(WebList webList) {
76
        _lists.add(webList);
×
77
    }
×
78

79
    /**
80
     * Gets the formats.
81
     *
82
     * @param characterPosition
83
     *            the character position
84
     *
85
     * @return the formats
86
     */
87
    String[] getFormats(int characterPosition) {
88
        return null;
×
89
    }
90

91
    static {
92
        MATCH_CLASS = (htmlElement, criteria) -> {
1✔
93
            if (criteria == null) {
1!
94
                criteria = "";
×
95
            }
96
            return ((BlockElement) htmlElement).getClassName().equalsIgnoreCase(criteria.toString());
1✔
97
        };
98

99
        MATCH_TAG = (htmlElement, criteria) -> {
1✔
100
            if (criteria == null) {
1!
101
                criteria = "";
×
102
            }
103
            return criteria.toString().equalsIgnoreCase(((BlockElement) htmlElement).getTagName());
1✔
104
        };
105
    }
1✔
106
}
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