• 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

89.36
/src/main/java/com/box/sdkgen/managers/sessiontermination/SessionTerminationManager.java
1
package com.box.sdkgen.managers.sessiontermination;
2

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

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

16
public class SessionTerminationManager {
17

18
  public Authentication auth;
19

20
  public NetworkSession networkSession;
21

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

26
  protected SessionTerminationManager(Builder builder) {
1✔
27
    this.auth = builder.auth;
1✔
28
    this.networkSession = builder.networkSession;
1✔
29
  }
1✔
30

31
  /**
32
   * Validates the roles and permissions of the user, and creates asynchronous jobs to terminate the
33
   * user's sessions. Returns the status for the POST request.
34
   *
35
   * @param requestBody Request body of terminateUsersSessions method
36
   */
37
  public SessionTerminationMessage terminateUsersSessions(
38
      TerminateUsersSessionsRequestBody requestBody) {
39
    return terminateUsersSessions(requestBody, new TerminateUsersSessionsHeaders());
1✔
40
  }
41

42
  /**
43
   * Validates the roles and permissions of the user, and creates asynchronous jobs to terminate the
44
   * user's sessions. Returns the status for the POST request.
45
   *
46
   * @param requestBody Request body of terminateUsersSessions method
47
   * @param headers Headers of terminateUsersSessions method
48
   */
49
  public SessionTerminationMessage terminateUsersSessions(
50
      TerminateUsersSessionsRequestBody requestBody, TerminateUsersSessionsHeaders headers) {
51
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
52
    FetchResponse response =
1✔
53
        this.networkSession
54
            .getNetworkClient()
1✔
55
            .fetch(
1✔
56
                new FetchOptions.Builder(
57
                        String.join(
1✔
58
                            "",
59
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
60
                            "/2.0/users/terminate_sessions"),
61
                        "POST")
62
                    .headers(headersMap)
1✔
63
                    .data(JsonManager.serialize(requestBody))
1✔
64
                    .contentType("application/json")
1✔
65
                    .responseFormat(ResponseFormat.JSON)
1✔
66
                    .auth(this.auth)
1✔
67
                    .networkSession(this.networkSession)
1✔
68
                    .build());
1✔
69
    return JsonManager.deserialize(response.getData(), SessionTerminationMessage.class);
1✔
70
  }
71

72
  /**
73
   * Validates the roles and permissions of the group, and creates asynchronous jobs to terminate
74
   * the group's sessions. Returns the status for the POST request.
75
   *
76
   * @param requestBody Request body of terminateGroupsSessions method
77
   */
78
  public SessionTerminationMessage terminateGroupsSessions(
79
      TerminateGroupsSessionsRequestBody requestBody) {
80
    return terminateGroupsSessions(requestBody, new TerminateGroupsSessionsHeaders());
1✔
81
  }
82

83
  /**
84
   * Validates the roles and permissions of the group, and creates asynchronous jobs to terminate
85
   * the group's sessions. Returns the status for the POST request.
86
   *
87
   * @param requestBody Request body of terminateGroupsSessions method
88
   * @param headers Headers of terminateGroupsSessions method
89
   */
90
  public SessionTerminationMessage terminateGroupsSessions(
91
      TerminateGroupsSessionsRequestBody requestBody, TerminateGroupsSessionsHeaders headers) {
92
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
93
    FetchResponse response =
1✔
94
        this.networkSession
95
            .getNetworkClient()
1✔
96
            .fetch(
1✔
97
                new FetchOptions.Builder(
98
                        String.join(
1✔
99
                            "",
100
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
101
                            "/2.0/groups/terminate_sessions"),
102
                        "POST")
103
                    .headers(headersMap)
1✔
104
                    .data(JsonManager.serialize(requestBody))
1✔
105
                    .contentType("application/json")
1✔
106
                    .responseFormat(ResponseFormat.JSON)
1✔
107
                    .auth(this.auth)
1✔
108
                    .networkSession(this.networkSession)
1✔
109
                    .build());
1✔
110
    return JsonManager.deserialize(response.getData(), SessionTerminationMessage.class);
1✔
111
  }
112

113
  public Authentication getAuth() {
114
    return auth;
×
115
  }
116

117
  public NetworkSession getNetworkSession() {
118
    return networkSession;
×
119
  }
120

121
  public static class Builder {
122

123
    protected Authentication auth;
124

125
    protected NetworkSession networkSession;
126

127
    public Builder() {
1✔
128
      this.networkSession = new NetworkSession();
1✔
129
    }
1✔
130

131
    public Builder auth(Authentication auth) {
132
      this.auth = auth;
1✔
133
      return this;
1✔
134
    }
135

136
    public Builder networkSession(NetworkSession networkSession) {
137
      this.networkSession = networkSession;
1✔
138
      return this;
1✔
139
    }
140

141
    public SessionTerminationManager build() {
142
      return new SessionTerminationManager(this);
1✔
143
    }
144
  }
145
}
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