1 | package com.renomad.minum.security; | |
2 | ||
3 | ||
4 | import com.renomad.minum.database.DbData; | |
5 | ||
6 | import java.util.Objects; | |
7 | ||
8 | import static com.renomad.minum.utils.SerializationUtils.deserializeHelper; | |
9 | import static com.renomad.minum.utils.SerializationUtils.serializeHelper; | |
10 | ||
11 | /** | |
12 | * Represents an inmate in our "jail". If someone does something we don't like, they do their time here. | |
13 | */ | |
14 | public final class Inmate extends DbData<Inmate> { | |
15 | ||
16 | /** | |
17 | * Builds an empty version of this class, except | |
18 | * that it has a current Context object | |
19 | */ | |
20 | public static final Inmate EMPTY = new Inmate(0L, "", 0L); | |
21 | private Long index; | |
22 | private final String clientId; | |
23 | private final Long releaseTime; | |
24 | ||
25 | /** | |
26 | * Represents an inmate in our "jail". If someone does something we don't like, they do their time here. | |
27 | * @param clientId a string representation of the client address plus a string representing the offense, | |
28 | * for example, "1.2.3.4_vuln_seeking" - 1.2.3.4 was seeking out vulnerabilities. | |
29 | * @param releaseTime the time, in milliseconds from the epoch, at which this inmate will be released | |
30 | * from the brig. | |
31 | */ | |
32 | public Inmate(Long index, String clientId, Long releaseTime) { | |
33 | this.index = index; | |
34 | this.clientId = clientId; | |
35 | this.releaseTime = releaseTime; | |
36 | } | |
37 | ||
38 | @Override | |
39 | public long getIndex() { | |
40 |
1
1. getIndex : replaced long return with 0 for com/renomad/minum/security/Inmate::getIndex → KILLED |
return index; |
41 | } | |
42 | ||
43 | @Override | |
44 | public void setIndex(long index) { | |
45 | this.index = index; | |
46 | } | |
47 | ||
48 | @Override | |
49 | public String serialize() { | |
50 |
1
1. serialize : replaced return value with "" for com/renomad/minum/security/Inmate::serialize → KILLED |
return serializeHelper(index, clientId, releaseTime); |
51 | } | |
52 | ||
53 | @Override | |
54 | public Inmate deserialize(String serializedText) { | |
55 | final var tokens = deserializeHelper(serializedText); | |
56 | ||
57 |
1
1. deserialize : replaced return value with null for com/renomad/minum/security/Inmate::deserialize → KILLED |
return new Inmate( |
58 | Long.parseLong(tokens.get(0)), | |
59 | tokens.get(1), | |
60 | Long.parseLong(tokens.get(2))); | |
61 | } | |
62 | ||
63 | public String getClientId() { | |
64 |
1
1. getClientId : replaced return value with "" for com/renomad/minum/security/Inmate::getClientId → KILLED |
return clientId; |
65 | } | |
66 | ||
67 | public Long getReleaseTime() { | |
68 |
1
1. getReleaseTime : replaced Long return value with 0L for com/renomad/minum/security/Inmate::getReleaseTime → KILLED |
return releaseTime; |
69 | } | |
70 | ||
71 | @Override | |
72 | public boolean equals(Object o) { | |
73 |
2
1. equals : replaced boolean return with false for com/renomad/minum/security/Inmate::equals → KILLED 2. equals : negated conditional → KILLED |
if (this == o) return true; |
74 |
3
1. equals : negated conditional → KILLED 2. equals : negated conditional → KILLED 3. equals : replaced boolean return with true for com/renomad/minum/security/Inmate::equals → KILLED |
if (o == null || getClass() != o.getClass()) return false; |
75 | Inmate inmate = (Inmate) o; | |
76 |
4
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with true for com/renomad/minum/security/Inmate::equals → KILLED 3. equals : negated conditional → KILLED 4. equals : negated conditional → KILLED |
return Objects.equals(index, inmate.index) && Objects.equals(clientId, inmate.clientId) && Objects.equals(releaseTime, inmate.releaseTime); |
77 | } | |
78 | ||
79 | @Override | |
80 | public int hashCode() { | |
81 |
1
1. hashCode : replaced int return with 0 for com/renomad/minum/security/Inmate::hashCode → KILLED |
return Objects.hash(index, clientId, releaseTime); |
82 | } | |
83 | ||
84 | @Override | |
85 | public String toString() { | |
86 |
1
1. toString : replaced return value with "" for com/renomad/minum/security/Inmate::toString → KILLED |
return "Inmate{" + |
87 | "index=" + index + | |
88 | ", clientId='" + clientId + '\'' + | |
89 | ", releaseTime=" + releaseTime + | |
90 | '}'; | |
91 | } | |
92 | } | |
Mutations | ||
40 |
1.1 |
|
50 |
1.1 |
|
57 |
1.1 |
|
64 |
1.1 |
|
68 |
1.1 |
|
73 |
1.1 2.2 |
|
74 |
1.1 2.2 3.3 |
|
76 |
1.1 2.2 3.3 4.4 |
|
81 |
1.1 |
|
86 |
1.1 |