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

box / box-java-sdk / #6242

10 Feb 2026 05:27PM UTC coverage: 35.714% (+11.4%) from 24.324%
#6242

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2146 existing lines in 544 files now uncovered.

7382 of 20670 relevant lines covered (35.71%)

0.4 hits per line

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

0.0
/src/main/java/com/box/sdkgen/managers/filewatermarks/FileWatermarksManager.java
1
package com.box.sdkgen.managers.filewatermarks;
2

3
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
5
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
6
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
7

8
import com.box.sdkgen.networking.auth.Authentication;
9
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
10
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
11
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
12
import com.box.sdkgen.networking.network.NetworkSession;
13
import com.box.sdkgen.schemas.watermark.Watermark;
14
import com.box.sdkgen.serialization.json.JsonManager;
15
import java.util.Map;
16

17
public class FileWatermarksManager {
18

19
  public Authentication auth;
20

21
  public NetworkSession networkSession;
22

23
  public FileWatermarksManager() {
×
24
    this.networkSession = new NetworkSession();
×
25
  }
×
26

27
  protected FileWatermarksManager(Builder builder) {
×
28
    this.auth = builder.auth;
×
29
    this.networkSession = builder.networkSession;
×
30
  }
×
31

32
  /**
33
   * Retrieve the watermark for a file.
34
   *
35
   * @param fileId The unique identifier that represents a file.
36
   *     <p>The ID for any file can be determined by visiting a file in the web application and
37
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
38
   *     `file_id` is `123`. Example: "12345"
39
   */
40
  public Watermark getFileWatermark(String fileId) {
41
    return getFileWatermark(fileId, new GetFileWatermarkHeaders());
×
42
  }
43

44
  /**
45
   * Retrieve the watermark for a file.
46
   *
47
   * @param fileId The unique identifier that represents a file.
48
   *     <p>The ID for any file can be determined by visiting a file in the web application and
49
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
50
   *     `file_id` is `123`. Example: "12345"
51
   * @param headers Headers of getFileWatermark method
52
   */
53
  public Watermark getFileWatermark(String fileId, GetFileWatermarkHeaders headers) {
54
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
55
    FetchResponse response =
×
56
        this.networkSession
57
            .getNetworkClient()
×
58
            .fetch(
×
59
                new FetchOptions.Builder(
60
                        String.join(
×
61
                            "",
62
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
63
                            "/2.0/files/",
64
                            convertToString(fileId),
×
65
                            "/watermark"),
66
                        "GET")
67
                    .headers(headersMap)
×
68
                    .responseFormat(ResponseFormat.JSON)
×
69
                    .auth(this.auth)
×
70
                    .networkSession(this.networkSession)
×
71
                    .build());
×
72
    return JsonManager.deserialize(response.getData(), Watermark.class);
×
73
  }
74

75
  /**
76
   * Applies or update a watermark on a file.
77
   *
78
   * @param fileId The unique identifier that represents a file.
79
   *     <p>The ID for any file can be determined by visiting a file in the web application and
80
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
81
   *     `file_id` is `123`. Example: "12345"
82
   * @param requestBody Request body of updateFileWatermark method
83
   */
84
  public Watermark updateFileWatermark(String fileId, UpdateFileWatermarkRequestBody requestBody) {
85
    return updateFileWatermark(fileId, requestBody, new UpdateFileWatermarkHeaders());
×
86
  }
87

88
  /**
89
   * Applies or update a watermark on a file.
90
   *
91
   * @param fileId The unique identifier that represents a file.
92
   *     <p>The ID for any file can be determined by visiting a file in the web application and
93
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
94
   *     `file_id` is `123`. Example: "12345"
95
   * @param requestBody Request body of updateFileWatermark method
96
   * @param headers Headers of updateFileWatermark method
97
   */
98
  public Watermark updateFileWatermark(
99
      String fileId,
100
      UpdateFileWatermarkRequestBody requestBody,
101
      UpdateFileWatermarkHeaders headers) {
102
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
103
    FetchResponse response =
×
104
        this.networkSession
105
            .getNetworkClient()
×
106
            .fetch(
×
107
                new FetchOptions.Builder(
108
                        String.join(
×
109
                            "",
110
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
111
                            "/2.0/files/",
112
                            convertToString(fileId),
×
113
                            "/watermark"),
114
                        "PUT")
115
                    .headers(headersMap)
×
116
                    .data(JsonManager.serialize(requestBody))
×
117
                    .contentType("application/json")
×
118
                    .responseFormat(ResponseFormat.JSON)
×
119
                    .auth(this.auth)
×
120
                    .networkSession(this.networkSession)
×
121
                    .build());
×
122
    return JsonManager.deserialize(response.getData(), Watermark.class);
×
123
  }
124

125
  /**
126
   * Removes the watermark from a file.
127
   *
128
   * @param fileId The unique identifier that represents a file.
129
   *     <p>The ID for any file can be determined by visiting a file in the web application and
130
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
131
   *     `file_id` is `123`. Example: "12345"
132
   */
133
  public void deleteFileWatermark(String fileId) {
134
    deleteFileWatermark(fileId, new DeleteFileWatermarkHeaders());
×
135
  }
×
136

137
  /**
138
   * Removes the watermark from a file.
139
   *
140
   * @param fileId The unique identifier that represents a file.
141
   *     <p>The ID for any file can be determined by visiting a file in the web application and
142
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
143
   *     `file_id` is `123`. Example: "12345"
144
   * @param headers Headers of deleteFileWatermark method
145
   */
146
  public void deleteFileWatermark(String fileId, DeleteFileWatermarkHeaders headers) {
147
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
148
    FetchResponse response =
×
149
        this.networkSession
150
            .getNetworkClient()
×
151
            .fetch(
×
152
                new FetchOptions.Builder(
153
                        String.join(
×
154
                            "",
155
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
156
                            "/2.0/files/",
157
                            convertToString(fileId),
×
158
                            "/watermark"),
159
                        "DELETE")
160
                    .headers(headersMap)
×
161
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
162
                    .auth(this.auth)
×
163
                    .networkSession(this.networkSession)
×
164
                    .build());
×
165
  }
×
166

167
  public Authentication getAuth() {
168
    return auth;
×
169
  }
170

171
  public NetworkSession getNetworkSession() {
172
    return networkSession;
×
173
  }
174

175
  public static class Builder {
176

177
    protected Authentication auth;
178

179
    protected NetworkSession networkSession;
180

NEW
181
    public Builder() {}
×
182

183
    public Builder auth(Authentication auth) {
UNCOV
184
      this.auth = auth;
×
UNCOV
185
      return this;
×
186
    }
187

188
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
189
      this.networkSession = networkSession;
×
UNCOV
190
      return this;
×
191
    }
192

193
    public FileWatermarksManager build() {
NEW
194
      if (this.networkSession == null) {
×
NEW
195
        this.networkSession = new NetworkSession();
×
196
      }
197
      return new FileWatermarksManager(this);
×
198
    }
199
  }
200
}
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