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

box / box-java-sdk / #6243

10 Feb 2026 05:27PM UTC coverage: 18.192% (-17.5%) from 35.714%
#6243

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

2147 existing lines in 545 files now uncovered.

7388 of 40611 relevant lines covered (18.19%)

0.21 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/emailaliases/EmailAliasesManager.java
1
package com.box.sdkgen.managers.emailaliases;
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.emailalias.EmailAlias;
14
import com.box.sdkgen.schemas.emailaliases.EmailAliases;
15
import com.box.sdkgen.serialization.json.JsonManager;
16
import java.util.Map;
17

18
public class EmailAliasesManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

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

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

33
  /**
34
   * Retrieves all email aliases for a user. The collection does not include the primary login for
35
   * the user.
36
   *
37
   * @param userId The ID of the user. Example: "12345"
38
   */
39
  public EmailAliases getUserEmailAliases(String userId) {
40
    return getUserEmailAliases(userId, new GetUserEmailAliasesHeaders());
×
41
  }
42

43
  /**
44
   * Retrieves all email aliases for a user. The collection does not include the primary login for
45
   * the user.
46
   *
47
   * @param userId The ID of the user. Example: "12345"
48
   * @param headers Headers of getUserEmailAliases method
49
   */
50
  public EmailAliases getUserEmailAliases(String userId, GetUserEmailAliasesHeaders headers) {
51
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
52
    FetchResponse response =
×
53
        this.networkSession
54
            .getNetworkClient()
×
55
            .fetch(
×
56
                new FetchOptions.Builder(
57
                        String.join(
×
58
                            "",
59
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
60
                            "/2.0/users/",
61
                            convertToString(userId),
×
62
                            "/email_aliases"),
63
                        "GET")
64
                    .headers(headersMap)
×
65
                    .responseFormat(ResponseFormat.JSON)
×
66
                    .auth(this.auth)
×
67
                    .networkSession(this.networkSession)
×
68
                    .build());
×
69
    return JsonManager.deserialize(response.getData(), EmailAliases.class);
×
70
  }
71

72
  /**
73
   * Adds a new email alias to a user account..
74
   *
75
   * @param userId The ID of the user. Example: "12345"
76
   * @param requestBody Request body of createUserEmailAlias method
77
   */
78
  public EmailAlias createUserEmailAlias(
79
      String userId, CreateUserEmailAliasRequestBody requestBody) {
80
    return createUserEmailAlias(userId, requestBody, new CreateUserEmailAliasHeaders());
×
81
  }
82

83
  /**
84
   * Adds a new email alias to a user account..
85
   *
86
   * @param userId The ID of the user. Example: "12345"
87
   * @param requestBody Request body of createUserEmailAlias method
88
   * @param headers Headers of createUserEmailAlias method
89
   */
90
  public EmailAlias createUserEmailAlias(
91
      String userId,
92
      CreateUserEmailAliasRequestBody requestBody,
93
      CreateUserEmailAliasHeaders headers) {
94
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
95
    FetchResponse response =
×
96
        this.networkSession
97
            .getNetworkClient()
×
98
            .fetch(
×
99
                new FetchOptions.Builder(
100
                        String.join(
×
101
                            "",
102
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
103
                            "/2.0/users/",
104
                            convertToString(userId),
×
105
                            "/email_aliases"),
106
                        "POST")
107
                    .headers(headersMap)
×
108
                    .data(JsonManager.serialize(requestBody))
×
109
                    .contentType("application/json")
×
110
                    .responseFormat(ResponseFormat.JSON)
×
111
                    .auth(this.auth)
×
112
                    .networkSession(this.networkSession)
×
113
                    .build());
×
114
    return JsonManager.deserialize(response.getData(), EmailAlias.class);
×
115
  }
116

117
  /**
118
   * Removes an email alias from a user.
119
   *
120
   * @param userId The ID of the user. Example: "12345"
121
   * @param emailAliasId The ID of the email alias. Example: "23432"
122
   */
123
  public void deleteUserEmailAliasById(String userId, String emailAliasId) {
124
    deleteUserEmailAliasById(userId, emailAliasId, new DeleteUserEmailAliasByIdHeaders());
×
125
  }
×
126

127
  /**
128
   * Removes an email alias from a user.
129
   *
130
   * @param userId The ID of the user. Example: "12345"
131
   * @param emailAliasId The ID of the email alias. Example: "23432"
132
   * @param headers Headers of deleteUserEmailAliasById method
133
   */
134
  public void deleteUserEmailAliasById(
135
      String userId, String emailAliasId, DeleteUserEmailAliasByIdHeaders headers) {
136
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
137
    FetchResponse response =
×
138
        this.networkSession
139
            .getNetworkClient()
×
140
            .fetch(
×
141
                new FetchOptions.Builder(
142
                        String.join(
×
143
                            "",
144
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
145
                            "/2.0/users/",
146
                            convertToString(userId),
×
147
                            "/email_aliases/",
148
                            convertToString(emailAliasId)),
×
149
                        "DELETE")
150
                    .headers(headersMap)
×
151
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
152
                    .auth(this.auth)
×
153
                    .networkSession(this.networkSession)
×
154
                    .build());
×
155
  }
×
156

157
  public Authentication getAuth() {
158
    return auth;
×
159
  }
160

161
  public NetworkSession getNetworkSession() {
162
    return networkSession;
×
163
  }
164

165
  public static class Builder {
166

167
    protected Authentication auth;
168

169
    protected NetworkSession networkSession;
170

NEW
171
    public Builder() {}
×
172

173
    public Builder auth(Authentication auth) {
UNCOV
174
      this.auth = auth;
×
UNCOV
175
      return this;
×
176
    }
177

178
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
179
      this.networkSession = networkSession;
×
UNCOV
180
      return this;
×
181
    }
182

183
    public EmailAliasesManager build() {
NEW
184
      if (this.networkSession == null) {
×
NEW
185
        this.networkSession = new NetworkSession();
×
186
      }
187
      return new EmailAliasesManager(this);
×
188
    }
189
  }
190
}
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