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

box / box-java-sdk / #5076

07 Oct 2025 12:35PM UTC coverage: 37.132% (+0.007%) from 37.125%
#5076

push

github

web-flow
test: Change `Event.additionalDetails` field assertion in events test (box/box-codegen#858) (#1491)

18454 of 49699 relevant lines covered (37.13%)

0.37 hits per line

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

86.79
/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) {
1✔
30
    this.auth = builder.auth;
1✔
31
    this.networkSession = builder.networkSession;
1✔
32
  }
1✔
33

34
  /** Fetches all the storage policies in the enterprise. */
35
  public StoragePolicies getStoragePolicies() {
36
    return getStoragePolicies(new GetStoragePoliciesQueryParams(), new GetStoragePoliciesHeaders());
1✔
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 =
1✔
66
        prepareParams(
1✔
67
            mapOf(
1✔
68
                entryOf("fields", convertToString(queryParams.getFields())),
1✔
69
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
70
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
71
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
72
    FetchResponse response =
1✔
73
        this.networkSession
74
            .getNetworkClient()
1✔
75
            .fetch(
1✔
76
                new FetchOptions.Builder(
77
                        String.join(
1✔
78
                            "",
79
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
80
                            "/2.0/storage_policies"),
81
                        "GET")
82
                    .params(queryParamsMap)
1✔
83
                    .headers(headersMap)
1✔
84
                    .responseFormat(ResponseFormat.JSON)
1✔
85
                    .auth(this.auth)
1✔
86
                    .networkSession(this.networkSession)
1✔
87
                    .build());
1✔
88
    return JsonManager.deserialize(response.getData(), StoragePolicies.class);
1✔
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());
1✔
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()));
1✔
109
    FetchResponse response =
1✔
110
        this.networkSession
111
            .getNetworkClient()
1✔
112
            .fetch(
1✔
113
                new FetchOptions.Builder(
114
                        String.join(
1✔
115
                            "",
116
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
117
                            "/2.0/storage_policies/",
118
                            convertToString(storagePolicyId)),
1✔
119
                        "GET")
120
                    .headers(headersMap)
1✔
121
                    .responseFormat(ResponseFormat.JSON)
1✔
122
                    .auth(this.auth)
1✔
123
                    .networkSession(this.networkSession)
1✔
124
                    .build());
1✔
125
    return JsonManager.deserialize(response.getData(), StoragePolicy.class);
1✔
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

142
    public Builder() {
1✔
143
      this.networkSession = new NetworkSession();
1✔
144
    }
1✔
145

146
    public Builder auth(Authentication auth) {
147
      this.auth = auth;
1✔
148
      return this;
1✔
149
    }
150

151
    public Builder networkSession(NetworkSession networkSession) {
152
      this.networkSession = networkSession;
1✔
153
      return this;
1✔
154
    }
155

156
    public StoragePoliciesManager build() {
157
      return new StoragePoliciesManager(this);
1✔
158
    }
159
  }
160
}
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