• 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

69.23
/src/main/java/com/meterware/servletunit/ServletTestCase.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.servletunit;
9

10
import junit.framework.TestCase;
11

12
/**
13
 * A base class for test cases to be run via {@link JUnitServlet JUnitServlet}.
14
 **/
15
public abstract class ServletTestCase extends TestCase {
16

17
    /** The invocation context factory. */
18
    private static InvocationContextFactory _invocationContextFactory;
19

20
    /**
21
     * construct a ServletTestCase with the given name.
22
     *
23
     * @param name
24
     *            the name
25
     */
26
    protected ServletTestCase(String name) {
27
        super(name);
1✔
28
    }
1✔
29

30
    /**
31
     * Returns a client object which can access the servlet context in which this test is running.
32
     *
33
     * @return the servlet unit client
34
     */
35
    protected final ServletUnitClient newClient() {
36
        if (_invocationContextFactory == null) {
1!
37
            throw new RuntimeException(
×
38
                    "ServletTestCase.newClient called before setInvocationContextFactory was called");
39
        }
40
        return ServletUnitClient.newClient(_invocationContextFactory);
1✔
41
    }
42

43
    /**
44
     * set the invocation context factory to be used.
45
     *
46
     * @param invocationContextFactory
47
     *            the new invocation context factory
48
     */
49
    static void setInvocationContextFactory(InvocationContextFactory invocationContextFactory) {
50
        if (invocationContextFactory == null) {
1!
51
            throw new RuntimeException(
×
52
                    "setInvocationContextFactory called with null invocationContextFactory parameter");
53
        }
54
        _invocationContextFactory = invocationContextFactory;
1✔
55
    }
1✔
56

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