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

box / box-java-sdk / #4076

12 Nov 2024 10:48AM UTC coverage: 71.771% (+0.03%) from 71.737%
#4076

Pull #1272

github

web-flow
Merge 8c67b7acb into 6ea70f79a
Pull Request #1272: feat: allow to modify the underlying client from the Box API connection subclasses

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

98 existing lines in 4 files now uncovered.

8052 of 11219 relevant lines covered (71.77%)

0.72 hits per line

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

0.0
/src/main/java/com/box/sdk/SharedLinkAPIConnection.java
1
package com.box.sdk;
2

3
import okhttp3.OkHttpClient;
4

5
/**
6
 * This API connection uses a shared link (along with an optional password) to authenticate with the Box API. It wraps a
7
 * preexisting BoxAPIConnection in order to provide additional access to items that are accessible with a shared link.
8
 * @deprecated Use {@link BoxItem#getSharedItem(BoxAPIConnection, String, String)} instead
9
 */
10
public class SharedLinkAPIConnection extends BoxAPIConnection {
11
    private final BoxAPIConnection wrappedConnection;
12
    private final String sharedLink;
13
    private final String sharedLinkPassword;
14

15
    public SharedLinkAPIConnection(BoxAPIConnection connection, String sharedLink) {
UNCOV
16
        this(connection, sharedLink, null);
×
UNCOV
17
    }
×
18

19
    public SharedLinkAPIConnection(BoxAPIConnection connection, String sharedLink, String sharedLinkPassword) {
20
        //this is a hack to maintain backward compatibility and to prevent confusing the compiler
21
        //between two possible BoxApiConnection constructors for super(null)
22
        super("");
×
23

24
        this.wrappedConnection = connection;
×
25
        this.sharedLink = sharedLink;
×
UNCOV
26
        this.sharedLinkPassword = sharedLinkPassword;
×
UNCOV
27
    }
×
28

29
    /**
30
     * {@inheritDoc}
31
     */
32
    @Override
33
    protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
NEW
34
        return super.modifyHttpClientBuilder(httpClientBuilder);
×
35
    }
36

37
    @Override
38
    public long getExpires() {
39
        return this.wrappedConnection.getExpires();
×
40
    }
41

42
    @Override
43
    public void setExpires(long milliseconds) {
44
        this.wrappedConnection.setExpires(milliseconds);
×
45
    }
×
46

47
    @Override
48
    public String getBaseURL() {
49
        return this.wrappedConnection.getBaseURL();
×
50
    }
51

52
    @Override
53
    public void setBaseURL(String baseURL) {
54
        this.wrappedConnection.setBaseURL(baseURL);
×
55
    }
×
56

57
    @Override
58
    public String getBaseUploadURL() {
59
        return this.wrappedConnection.getBaseUploadURL();
×
60
    }
61

62
    @Override
63
    public void setBaseUploadURL(String baseUploadURL) {
64
        this.wrappedConnection.setBaseUploadURL(baseUploadURL);
×
65
    }
×
66

67
    @Override
68
    public String getUserAgent() {
69
        return this.wrappedConnection.getUserAgent();
×
70
    }
71

72
    @Override
73
    public void setUserAgent(String userAgent) {
74
        this.wrappedConnection.setUserAgent(userAgent);
×
75
    }
×
76

77
    @Override
78
    public String getAccessToken() {
79
        return this.wrappedConnection.getAccessToken();
×
80
    }
81

82
    @Override
83
    public void setAccessToken(String accessToken) {
84
        this.wrappedConnection.setAccessToken(accessToken);
×
85
    }
×
86

87
    @Override
88
    public String getRefreshToken() {
89
        return this.wrappedConnection.getRefreshToken();
×
90
    }
91

92
    @Override
93
    public void setRefreshToken(String refreshToken) {
94
        this.wrappedConnection.setRefreshToken(refreshToken);
×
95
    }
×
96

97
    @Override
98
    public boolean getAutoRefresh() {
UNCOV
99
        return this.wrappedConnection.getAutoRefresh();
×
100
    }
101

102
    @Override
103
    public void setAutoRefresh(boolean autoRefresh) {
UNCOV
104
        this.wrappedConnection.setAutoRefresh(autoRefresh);
×
105
    }
×
106

107
    /**
108
     * Gets the maximum number of times an API request will be retried after an error response
109
     * is received.
110
     *
111
     * @return the maximum number of request attempts.
112
     */
113
    @Override
114
    public int getMaxRetryAttempts() {
UNCOV
115
        return this.wrappedConnection.getMaxRetryAttempts();
×
116
    }
117

118
    /**
119
     * Sets the maximum number of times an API request will be retried after an error response
120
     * is received.
121
     *
122
     * @param attempts the maximum number of request attempts.
123
     */
124
    @Override
125
    public void setMaxRetryAttempts(int attempts) {
126
        this.wrappedConnection.setMaxRetryAttempts(attempts);
×
UNCOV
127
    }
×
128

129
    @Override
130
    public boolean canRefresh() {
131
        return this.wrappedConnection.canRefresh();
×
132
    }
133

134
    @Override
135
    public boolean needsRefresh() {
136
        return this.wrappedConnection.needsRefresh();
×
137
    }
138

139
    @Override
140
    public void refresh() {
141
        this.wrappedConnection.refresh();
×
142
    }
×
143

144
    @Override
145
    String lockAccessToken() {
146
        return this.wrappedConnection.lockAccessToken();
×
147
    }
148

149
    @Override
150
    void unlockAccessToken() {
UNCOV
151
        this.wrappedConnection.unlockAccessToken();
×
UNCOV
152
    }
×
153

154
    @Override
155
    public RequestInterceptor getRequestInterceptor() {
UNCOV
156
        return this.wrappedConnection.getRequestInterceptor();
×
157
    }
158

159
    /**
160
     * Gets the shared link used for accessing shared items.
161
     *
162
     * @return the shared link used for accessing shared items.
163
     */
164
    String getSharedLink() {
UNCOV
165
        return this.sharedLink;
×
166
    }
167

168
    /**
169
     * Gets the shared link password used for accessing shared items.
170
     *
171
     * @return the shared link password used for accessing shared items.
172
     */
173
    String getSharedLinkPassword() {
UNCOV
174
        return this.sharedLinkPassword;
×
175
    }
176
}
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