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

smartsheet / smartsheet-java-sdk / #60

24 Oct 2025 09:43AM UTC coverage: 60.156% (+0.4%) from 59.737%
#60

push

github

web-flow
Add Wiremock integration tests and update dependencies (#145)

* Add Wiremock integration tests and update dependencies

* Update test method names

* Bump version to 3.9.0 and address comments for the wiremock integration tests

* Refactor Wiremock integration tests for user resources to improve query parameter handling and update endpoint paths

* Fix imports

* Fix checkstyle errors

* Move wiremock tests to sdktest

* Remove redundant Wiremock tests from UserResourcesIT

* Remove unused imports from UserResourcesIT

* Revert UserResourcesIT

* Fix changelog

* Add copyright to WiremockTest

* Update wiremock base uri port

* Rename WiremockTest to UserResourcesContractTests for clarity

* Change WireMock default port

4392 of 7301 relevant lines covered (60.16%)

0.6 hits per line

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

17.78
/src/main/java/com/smartsheet/api/models/User.java
1
/*
2
 * Copyright (C) 2025 Smartsheet
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.smartsheet.api.models;
18

19
import java.time.ZonedDateTime;
20
import com.smartsheet.api.models.enums.SeatType;
21

22
/**
23
 * Represents the User object.
24
 *
25
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/795920-managing-users-team-enterprise-only-">Help
26
 * Managing Users</a>
27
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/520100-user-types">User Types Help</a>
28
 */
29
public class User extends UserModelWithName {
1✔
30

31
    /**
32
     * Seat type support fields
33
     */
34
    private Long planId;
35
    private SeatType seatType;
36
    private ZonedDateTime seatTypeLastChangedAt;
37
    private Boolean isInternal;
38
    private ZonedDateTime provisionalExpirationDate;
39

40
    public Long getPlanId() {
41
        return planId;
1✔
42
    }
43

44
    public void setPlanId(Long planId) {
45
        this.planId = planId;
1✔
46
    }
1✔
47

48
    public SeatType getSeatType() {
49
        return seatType;
1✔
50
    }
51

52
    public void setSeatType(SeatType seatType) {
53
        this.seatType = seatType;
1✔
54
    }
1✔
55

56
    public ZonedDateTime getSeatTypeLastChangedAt() {
57
        return seatTypeLastChangedAt;
1✔
58
    }
59

60
    public void setSeatTypeLastChangedAt(ZonedDateTime seatTypeLastChangedAt) {
61
        this.seatTypeLastChangedAt = seatTypeLastChangedAt;
1✔
62
    }
1✔
63

64
    public ZonedDateTime getProvisionalExpirationDate() { return provisionalExpirationDate; }
1✔
65

66
    public void setProvisionalExpirationDate(ZonedDateTime provisionalExpirationDate) {
67
        this.provisionalExpirationDate = provisionalExpirationDate;
1✔
68
    }
1✔
69

70
    public Boolean getIsInternal() {
71
        return isInternal;
1✔
72
    }
73

74
    public void setIsInternal(Boolean isInternal) {
75
        this.isInternal = isInternal;
1✔
76
    }
1✔
77

78
    /**
79
     * A convenience class for making a {@link User} object with the appropriate fields for adding the user.
80
     */
81

82
    public static class AddUserBuilder {
×
83
        private Boolean admin;
84
        private String emailAddress;
85
        private Boolean licensedSheetCreator;
86
        private Boolean groupAdmin;
87
        private Boolean resourceViewer;
88
        private String firstName;
89
        private String lastName;
90

91
        /**
92
         * Sets the admin flag which allows managing users and accounts.
93
         *
94
         * @param admin the admin
95
         * @return the adds the user builder
96
         */
97
        public AddUserBuilder setAdmin(Boolean admin) {
98
            this.admin = admin;
×
99
            return this;
×
100
        }
101

102
        /**
103
         * Sets the licensed sheet creator flag that allows creating and owning sheets.
104
         *
105
         * @param licensedSheetCreator the licensed sheet creator
106
         * @return the adds the user builder
107
         */
108
        public AddUserBuilder setLicensedSheetCreator(Boolean licensedSheetCreator) {
109
            this.licensedSheetCreator = licensedSheetCreator;
×
110
            return this;
×
111
        }
112

113
        /**
114
         * Sets the email for the user.
115
         *
116
         * @param email the email
117
         * @return the adds the user builder
118
         */
119
        public AddUserBuilder setEmail(String email) {
120
            this.emailAddress = email;
×
121
            return this;
×
122
        }
123

124
        /**
125
         * Gets the admin.
126
         *
127
         * @return the admin
128
         */
129
        public Boolean getAdmin() {
130
            return admin;
×
131
        }
132

133
        /**
134
         * Gets the licensed sheet creator.
135
         *
136
         * @return the licensed sheet creator
137
         */
138
        public Boolean getLicensedSheetCreator() {
139
            return licensedSheetCreator;
×
140
        }
141

142
        /**
143
         * @return the firstName
144
         */
145
        public String getFirstName() {
146
            return firstName;
×
147
        }
148

149
        /**
150
         * @param firstName the firstName to set
151
         * @return the builder
152
         */
153
        public AddUserBuilder setFirstName(String firstName) {
154
            this.firstName = firstName;
×
155
            return this;
×
156
        }
157

158
        /**
159
         * @return the lastName
160
         */
161
        public String getLastName() {
162
            return lastName;
×
163
        }
164

165
        /**
166
         * @param lastName the lastName to set
167
         * @return the builder
168
         */
169
        public AddUserBuilder setLastName(String lastName) {
170
            this.lastName = lastName;
×
171
            return this;
×
172
        }
173

174
        /**
175
         * @return the groupAdmin
176
         */
177
        public Boolean getGroupAdmin() {
178
            return groupAdmin;
×
179
        }
180

181
        /**
182
         * @param groupAdmin the groupAdmin to set
183
         * @return the builder
184
         */
185
        public AddUserBuilder setGroupAdmin(Boolean groupAdmin) {
186
            this.groupAdmin = groupAdmin;
×
187
            return this;
×
188
        }
189

190
        /**
191
         * @return the resourceViewer
192
         */
193
        public Boolean getResourceViewer() {
194
            return resourceViewer;
×
195
        }
196

197
        /**
198
         * @param resourceViewer the resourceViewer to set
199
         * @return the builder
200
         */
201
        public AddUserBuilder setResourceViewer(Boolean resourceViewer) {
202
            this.resourceViewer = resourceViewer;
×
203
            return this;
×
204
        }
205

206
        /**
207
         * Builds the {@link User} object using the required fields.
208
         *
209
         * @return the user
210
         */
211
        public User build() {
212
            if (admin == null || emailAddress == null || licensedSheetCreator == null) {
×
213
                throw new InstantiationError();
×
214
            }
215

216
            User user = new User();
×
217
            user.setAdmin(admin);
×
218
            user.setLicensedSheetCreator(licensedSheetCreator);
×
219
            user.setGroupAdmin(groupAdmin);
×
220
            user.setResourceViewer(resourceViewer);
×
221
            user.setFirstName(firstName);
×
222
            user.setLastName(lastName);
×
223
            user.setEmail(emailAddress);
×
224

225
            return user;
×
226
        }
227

228
    }
229

230
    /**
231
     * A convenience class for making a {@link User} object with the appropriate fields for updating a user.
232
     */
233
    public static class UpdateUserBuilder {
×
234
        private Boolean admin;
235
        private Boolean licensedSheetCreator;
236
        private Boolean groupAdmin;
237
        private Boolean resourceViewer;
238
        private String firstName;
239
        private String lastName;
240
        private Long id;
241

242
        /**
243
         * Get the id of the user
244
         *
245
         * @return the id
246
         */
247
        public Long getUserId() {
248
            return id;
×
249
        }
250

251
        /**
252
         * Set the user id
253
         *
254
         * @param userId the user id
255
         * @return the updateSheetBuilder object
256
         */
257
        public UpdateUserBuilder setUserId(Long userId) {
258
            this.id = userId;
×
259
            return this;
×
260
        }
261

262
        /**
263
         * Sets the admin flag which allows managing users and accounts.
264
         *
265
         * @param admin the admin
266
         * @return the update user builder
267
         */
268
        public UpdateUserBuilder setAdmin(Boolean admin) {
269
            this.admin = admin;
×
270
            return this;
×
271
        }
272

273
        /**
274
         * Licensed sheet creator.
275
         *
276
         * @param licensedSheetCreator the licensed sheet creator
277
         * @return the update user builder
278
         */
279
        public UpdateUserBuilder setLicensedSheetCreator(Boolean licensedSheetCreator) {
280
            this.licensedSheetCreator = licensedSheetCreator;
×
281
            return this;
×
282
        }
283

284
        /**
285
         * Gets the admin.
286
         *
287
         * @return the admin
288
         */
289
        public Boolean getAdmin() {
290
            return admin;
×
291
        }
292

293
        /**
294
         * Gets the licensed sheet creator.
295
         *
296
         * @return the licensed sheet creator
297
         */
298
        public Boolean getLicensedSheetCreator() {
299
            return licensedSheetCreator;
×
300
        }
301

302
        /**
303
         * @return the firstName
304
         */
305
        public String getFirstName() {
306
            return firstName;
×
307
        }
308

309
        /**
310
         * @param firstName the firstName to set
311
         * @return the builder
312
         */
313
        public UpdateUserBuilder setFirstName(String firstName) {
314
            this.firstName = firstName;
×
315
            return this;
×
316
        }
317

318
        /**
319
         * @return the lastName
320
         */
321
        public String getLastName() {
322
            return lastName;
×
323
        }
324

325
        /**
326
         * @param lastName the lastName to set
327
         * @return the builder
328
         */
329
        public UpdateUserBuilder setLastName(String lastName) {
330
            this.lastName = lastName;
×
331
            return this;
×
332
        }
333

334
        /**
335
         * @return the groupAdmin
336
         */
337
        public Boolean getGroupAdmin() {
338
            return groupAdmin;
×
339
        }
340

341
        /**
342
         * @param groupAdmin the groupAdmin to set
343
         * @return the builder
344
         */
345
        public UpdateUserBuilder setGroupAdmin(Boolean groupAdmin) {
346
            this.groupAdmin = groupAdmin;
×
347
            return this;
×
348
        }
349

350
        /**
351
         * @return the resourceViewer
352
         */
353
        public Boolean getResourceViewer() {
354
            return resourceViewer;
×
355
        }
356

357
        /**
358
         * @param resourceViewer the resourceViewer to set
359
         * @return the builder
360
         */
361
        public UpdateUserBuilder setResourceViewer(Boolean resourceViewer) {
362
            this.resourceViewer = resourceViewer;
×
363
            return this;
×
364
        }
365

366
        /**
367
         * Builds the {@link User}.
368
         *
369
         * @return the user
370
         */
371
        public User build() {
372
            if (admin == null || licensedSheetCreator == null || id == null) {
×
373
                throw new InstantiationError("An admin, licensed sheet creator and user Id must be set");
×
374
            }
375

376
            User user = new User();
×
377
            user.setFirstName(firstName);
×
378
            user.setLastName(lastName);
×
379
            user.setAdmin(admin);
×
380
            user.setLicensedSheetCreator(licensedSheetCreator);
×
381
            user.setGroupAdmin(groupAdmin);
×
382
            user.setResourceViewer(resourceViewer);
×
383
            user.setId(id);
×
384
            return user;
×
385
        }
386
    }
387

388
    /**
389
     * A convenience class for making a GroupMember object with the appropriate fields for adding to a {@link Group}.
390
     */
391
    public static class NewGroupMemberBuilder {
×
392
        private String email;
393

394
        /**
395
         * Get the email of the user
396
         *
397
         * @return email the email
398
         */
399
        public String getEmail() {
400
            return email;
×
401
        }
402

403
        /**
404
         * Set the email id of the user
405
         *
406
         * @param email the email
407
         * @return the builder
408
         */
409
        public NewGroupMemberBuilder setEmail(String email) {
410
            this.email = email;
×
411
            return this;
×
412
        }
413

414
        /**
415
         * Build a User
416
         */
417
        public User build() {
418
            if (email == null) {
×
419
                throw new InstantiationError("An email address must be set.");
×
420
            }
421

422
            User user = new User();
×
423
            user.setEmail(email);
×
424
            return user;
×
425
        }
426
    }
427
}
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

© 2025 Coveralls, Inc