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

box / box-java-sdk / #6241

10 Feb 2026 05:27PM UTC coverage: 24.324% (+11.5%) from 12.84%
#6241

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%)

2130 existing lines in 537 files now uncovered.

7388 of 30373 relevant lines covered (24.32%)

0.28 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/storagepolicies/StoragePoliciesManager.java
1
package com.box.sdkgen.managers.storagepolicies;
2

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

9
import com.box.sdkgen.networking.auth.Authentication;
10
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
11
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
12
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
13
import com.box.sdkgen.networking.network.NetworkSession;
14
import com.box.sdkgen.schemas.storagepolicies.StoragePolicies;
15
import com.box.sdkgen.schemas.storagepolicy.StoragePolicy;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class StoragePoliciesManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

25
  public StoragePoliciesManager() {
×
26
    this.networkSession = new NetworkSession();
×
27
  }
×
28

29
  protected StoragePoliciesManager(Builder builder) {
×
30
    this.auth = builder.auth;
×
31
    this.networkSession = builder.networkSession;
×
32
  }
×
33

34
  /** Fetches all the storage policies in the enterprise. */
35
  public StoragePolicies getStoragePolicies() {
36
    return getStoragePolicies(new GetStoragePoliciesQueryParams(), new GetStoragePoliciesHeaders());
×
37
  }
38

39
  /**
40
   * Fetches all the storage policies in the enterprise.
41
   *
42
   * @param queryParams Query parameters of getStoragePolicies method
43
   */
44
  public StoragePolicies getStoragePolicies(GetStoragePoliciesQueryParams queryParams) {
45
    return getStoragePolicies(queryParams, new GetStoragePoliciesHeaders());
×
46
  }
47

48
  /**
49
   * Fetches all the storage policies in the enterprise.
50
   *
51
   * @param headers Headers of getStoragePolicies method
52
   */
53
  public StoragePolicies getStoragePolicies(GetStoragePoliciesHeaders headers) {
54
    return getStoragePolicies(new GetStoragePoliciesQueryParams(), headers);
×
55
  }
56

57
  /**
58
   * Fetches all the storage policies in the enterprise.
59
   *
60
   * @param queryParams Query parameters of getStoragePolicies method
61
   * @param headers Headers of getStoragePolicies method
62
   */
63
  public StoragePolicies getStoragePolicies(
64
      GetStoragePoliciesQueryParams queryParams, GetStoragePoliciesHeaders headers) {
65
    Map<String, String> queryParamsMap =
×
66
        prepareParams(
×
67
            mapOf(
×
68
                entryOf("fields", convertToString(queryParams.getFields())),
×
69
                entryOf("marker", convertToString(queryParams.getMarker())),
×
70
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
71
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
72
    FetchResponse response =
×
73
        this.networkSession
74
            .getNetworkClient()
×
75
            .fetch(
×
76
                new FetchOptions.Builder(
77
                        String.join(
×
78
                            "",
79
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
80
                            "/2.0/storage_policies"),
81
                        "GET")
82
                    .params(queryParamsMap)
×
83
                    .headers(headersMap)
×
84
                    .responseFormat(ResponseFormat.JSON)
×
85
                    .auth(this.auth)
×
86
                    .networkSession(this.networkSession)
×
87
                    .build());
×
88
    return JsonManager.deserialize(response.getData(), StoragePolicies.class);
×
89
  }
90

91
  /**
92
   * Fetches a specific storage policy.
93
   *
94
   * @param storagePolicyId The ID of the storage policy. Example: "34342"
95
   */
96
  public StoragePolicy getStoragePolicyById(String storagePolicyId) {
97
    return getStoragePolicyById(storagePolicyId, new GetStoragePolicyByIdHeaders());
×
98
  }
99

100
  /**
101
   * Fetches a specific storage policy.
102
   *
103
   * @param storagePolicyId The ID of the storage policy. Example: "34342"
104
   * @param headers Headers of getStoragePolicyById method
105
   */
106
  public StoragePolicy getStoragePolicyById(
107
      String storagePolicyId, GetStoragePolicyByIdHeaders headers) {
108
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
109
    FetchResponse response =
×
110
        this.networkSession
111
            .getNetworkClient()
×
112
            .fetch(
×
113
                new FetchOptions.Builder(
114
                        String.join(
×
115
                            "",
116
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
117
                            "/2.0/storage_policies/",
118
                            convertToString(storagePolicyId)),
×
119
                        "GET")
120
                    .headers(headersMap)
×
121
                    .responseFormat(ResponseFormat.JSON)
×
122
                    .auth(this.auth)
×
123
                    .networkSession(this.networkSession)
×
124
                    .build());
×
125
    return JsonManager.deserialize(response.getData(), StoragePolicy.class);
×
126
  }
127

128
  public Authentication getAuth() {
129
    return auth;
×
130
  }
131

132
  public NetworkSession getNetworkSession() {
133
    return networkSession;
×
134
  }
135

136
  public static class Builder {
137

138
    protected Authentication auth;
139

140
    protected NetworkSession networkSession;
141

NEW
142
    public Builder() {}
×
143

144
    public Builder auth(Authentication auth) {
UNCOV
145
      this.auth = auth;
×
UNCOV
146
      return this;
×
147
    }
148

149
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
150
      this.networkSession = networkSession;
×
UNCOV
151
      return this;
×
152
    }
153

154
    public StoragePoliciesManager build() {
NEW
155
      if (this.networkSession == null) {
×
NEW
156
        this.networkSession = new NetworkSession();
×
157
      }
158
      return new StoragePoliciesManager(this);
×
159
    }
160
  }
161
}
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