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

SingingBush / dubclient / 381

26 Sep 2025 12:09PM UTC coverage: 37.154% (+0.08%) from 37.073%
381

push

github

SingingBush
Add stopbugs plugin and run during verify phase

39 of 242 branches covered (16.12%)

Branch coverage included in aggregate %.

2 of 4 new or added lines in 3 files covered. (50.0%)

34 existing lines in 2 files now uncovered.

243 of 517 relevant lines covered (47.0%)

1.05 hits per line

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

48.15
/src/main/java/com/singingbush/dubclient/DubClientBuilder.java
1
package com.singingbush.dubclient;
2

3
import org.jetbrains.annotations.NotNull;
4
import org.jetbrains.annotations.Nullable;
5

6
import javax.net.ssl.SSLContext;
7
import java.time.Duration;
8
import java.util.StringJoiner;
9

10
/**
11
 * @author Samael Bate (singingbush)
12
 * created on 16/06/18
13
 */
14
public class DubClientBuilder {
15

16
    private String scheme = "https";
3✔
17
    private String hostName = "code.dlang.org";
3✔
18
    private int port = 443;
3✔
19
    private long timeout = 2_000;
3✔
20
    private String userAgent = "Java DUB Client";
3✔
21
    @Nullable
22
    private SSLContext sslContext;
23

24
    // should be created via the DubClient interface
25
    DubClientBuilder() {}
3✔
26

27
    public DubClientBuilder withScheme(@NotNull final String scheme) {
28
        this.scheme = scheme;
3✔
29
        return this;
3✔
30
    }
31

32
    public DubClientBuilder withHostname(@NotNull final String hostName) {
33
        this.hostName = hostName;
3✔
34
        return this;
3✔
35
    }
36

37
    public DubClientBuilder withPort(final int port) {
38
        this.port = port;
2✔
39
        return this;
2✔
40
    }
41

42
    public DubClientBuilder withTimeout(final long milliseconds) {
UNCOV
43
        this.timeout = milliseconds;
×
UNCOV
44
        return this;
×
45
    }
46

47
    public DubClientBuilder withTimeout(@NotNull final Duration duration) {
UNCOV
48
        return this.withTimeout(duration.toMillis());
×
49
    }
50

51
    public DubClientBuilder withUserAgent(@NotNull final String userAgent) {
UNCOV
52
        this.userAgent = userAgent;
×
UNCOV
53
        return this;
×
54
    }
55

56
    public DubClientBuilder withSslContext(final SSLContext sslContext) {
UNCOV
57
        this.sslContext = sslContext;
×
UNCOV
58
        return this;
×
59
    }
60

61
    public DubClient build() {
62
        return new DubClientImpl(scheme, hostName, port, timeout, userAgent, sslContext);
3✔
63
    }
64

65
    @Override
66
    public String toString() {
UNCOV
67
        return new StringJoiner(", ", DubClientBuilder.class.getSimpleName() + "[", "]")
×
UNCOV
68
            .add("scheme='" + scheme + "'")
×
UNCOV
69
            .add("hostName='" + hostName + "'")
×
UNCOV
70
            .add("port=" + port)
×
UNCOV
71
            .add("timeout=" + timeout)
×
UNCOV
72
            .add("userAgent='" + userAgent + "'")
×
UNCOV
73
            .toString();
×
74
    }
75
}
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