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

hazendaz / httpunit / 755

14 Feb 2026 07:14PM UTC coverage: 80.526%. Remained the same
755

push

github

hazendaz
[ci] Fix badge

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10124 relevant lines covered (81.44%)

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
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2000-2026 Russell Gold
6
 * Copyright 2021-2000 hazendaz
7
 */
8
package com.meterware.httpunit;
9

10
import java.net.URL;
11
import java.util.ArrayList;
12

13
import org.w3c.dom.Node;
14

15
/**
16
 * A class which represents a block of text in a web page. Experimental.
17
 **/
18
public class TextBlock extends BlockElement {
19

20
    /** The lists. */
21
    private ArrayList _lists = new ArrayList<>();
1✔
22
    /** Predicate to match part or all of a block's class attribute. **/
23
    public static final HTMLElementPredicate MATCH_CLASS;
24
    /** Predicate to match the tag associated with a block (case insensitive). **/
25
    public static final HTMLElementPredicate MATCH_TAG;
26

27
    /**
28
     * Instantiates a new text block.
29
     *
30
     * @param response
31
     *            the response
32
     * @param frame
33
     *            the frame
34
     * @param baseURL
35
     *            the base URL
36
     * @param baseTarget
37
     *            the base target
38
     * @param rootNode
39
     *            the root node
40
     * @param characterSet
41
     *            the character set
42
     */
43
    public TextBlock(WebResponse response, FrameSelector frame, URL baseURL, String baseTarget, Node rootNode,
44
            String characterSet) {
45
        super(response, frame, baseURL, baseTarget, rootNode, characterSet);
1✔
46
    }
1✔
47

48
    /**
49
     * Returns any lists embedded in this text block.
50
     *
51
     * @return the lists
52
     */
53
    public WebList[] getLists() {
54
        return (WebList[]) _lists.toArray(new WebList[_lists.size()]);
×
55
    }
56

57
    /**
58
     * Adds the list.
59
     *
60
     * @param webList
61
     *            the web list
62
     */
63
    void addList(WebList webList) {
64
        _lists.add(webList);
×
65
    }
×
66

67
    /**
68
     * Gets the formats.
69
     *
70
     * @param characterPosition
71
     *            the character position
72
     *
73
     * @return the formats
74
     */
75
    String[] getFormats(int characterPosition) {
76
        return null;
×
77
    }
78

79
    static {
80
        MATCH_CLASS = (htmlElement, criteria) -> {
1✔
81
            if (criteria == null) {
1!
82
                criteria = "";
×
83
            }
84
            return ((BlockElement) htmlElement).getClassName().equalsIgnoreCase(criteria.toString());
1✔
85
        };
86

87
        MATCH_TAG = (htmlElement, criteria) -> {
1✔
88
            if (criteria == null) {
1!
89
                criteria = "";
×
90
            }
91
            return criteria.toString().equalsIgnoreCase(((BlockElement) htmlElement).getTagName());
1✔
92
        };
93
    }
1✔
94
}
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