Skip to content

Package: CucUser

CucUser

nameinstructionbranchcomplexitylinemethod
CucUser()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getDisplayName()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEmail()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getExpirationDate()
M: 49 C: 0
0%
M: 6 C: 0
0%
M: 5 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%
getName()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPassword()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPhoneNumber()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getScopeId()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getStatus()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUserType()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setDisplayName(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setEmail(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setExpirationDate(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setName(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setPassword(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setPhoneNumber(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setScopeId(BigInteger)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setStatus(UserStatus)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setUserType(UserType)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech
12: *******************************************************************************/
13: package org.eclipse.kapua.qa.common.cucumber;
14:
15: import java.math.BigInteger;
16: import java.text.DateFormat;
17: import java.text.ParseException;
18: import java.text.SimpleDateFormat;
19: import java.time.Duration;
20: import java.time.Instant;
21: import java.util.Date;
22:
23: import org.eclipse.kapua.service.user.UserStatus;
24: import org.eclipse.kapua.service.user.UserType;
25:
26: /**
27: * Data object used in Gherkin to transfer User data.
28: */
29: public class CucUser {
30:
31: private String name;
32:
33: private String displayName;
34:
35: private String email;
36:
37: private String phoneNumber;
38:
39: private UserStatus status;
40:
41: private UserType userType;
42:
43: private BigInteger scopeId;
44:
45: private String password;
46:
47: private String expirationDate;
48:
49: public String getName() {
50: return name;
51: }
52:
53: public void setName(String name) {
54: this.name = name;
55: }
56:
57: public String getPassword() {
58: return password;
59: }
60:
61: public void setPassword(String password) {
62: this.password = password;
63: }
64:
65: public String getDisplayName() {
66: return displayName;
67: }
68:
69: public void setDisplayName(String displayName) {
70: this.displayName = displayName;
71: }
72:
73: public String getEmail() {
74: return email;
75: }
76:
77: public void setEmail(String email) {
78: this.email = email;
79: }
80:
81: public String getPhoneNumber() {
82: return phoneNumber;
83: }
84:
85: public void setPhoneNumber(String phoneNumber) {
86: this.phoneNumber = phoneNumber;
87: }
88:
89: public UserStatus getStatus() {
90: return status;
91: }
92:
93: public void setStatus(UserStatus status) {
94: this.status = status;
95: }
96:
97: public UserType getUserType() {
98: return userType;
99: }
100:
101: public void setUserType(UserType userType) {
102: this.userType = userType;
103: }
104:
105: public BigInteger getScopeId() {
106: return scopeId;
107: }
108:
109: public void setScopeId(BigInteger scopeId) {
110: this.scopeId = scopeId;
111: }
112:
113: public Date getExpirationDate() {
114: DateFormat df = new SimpleDateFormat("dd/mm/yyyy");
115: Date expDate = null;
116: Instant now = Instant.now();
117:
118:• if (expirationDate == null) {
119: return null;
120: }
121: // Special keywords for date
122:• switch (expirationDate) {
123: case "yesterday":
124: expDate = Date.from(now.minus(Duration.ofDays(1)));
125: break;
126: case "today":
127: expDate = Date.from(now);
128: break;
129: case "tomorrow":
130: expDate = Date.from(now.plus(Duration.ofDays(1)));
131: break;
132: }
133: // Just parse date
134: try {
135: expDate = df.parse(expirationDate);
136: } catch (ParseException | NullPointerException e) {
137: // skip, leave date null
138: }
139:
140: return expDate;
141: }
142:
143: public void setExpirationDate(String expirationDate) {
144: this.expirationDate = expirationDate;
145: }
146: }