| 1 | package com.seshira.events.person.domain.models; | |
| 2 | ||
| 3 | import com.seshira.events.common.models.thing.Thing; | |
| 4 | import com.seshira.events.common.models.thing.ThingType; | |
| 5 | import lombok.Getter; | |
| 6 | import lombok.Setter; | |
| 7 | ||
| 8 | import java.util.UUID; | |
| 9 | ||
| 10 | @Setter | |
| 11 | @Getter | |
| 12 | public class Person extends Thing { | |
| 13 | private String givenName; | |
| 14 | private String familyName; | |
| 15 | private String nationality; // alpha-3 code | |
| 16 | private String email = null; | |
| 17 | ||
| 18 | public Person(String givenName, String familyName, String nationality, String email) { | |
| 19 | this(givenName, familyName, nationality); | |
| 20 | this.email = email; | |
| 21 | } | |
| 22 | ||
| 23 | public Person(String givenName, String familyName, String nationality) { | |
| 24 | super(UUID.randomUUID(), ThingType.PERSON, ""); | |
| 25 | String trimmedGivenName = trim(givenName); | |
| 26 | String trimmedFamilyName = trim(familyName); | |
| 27 |
1
1. <init> : removed call to com/seshira/events/common/models/thing/Thing::setDescription → SURVIVED |
super.setDescription(trimmedGivenName + " " + trimmedFamilyName); |
| 28 | this.givenName = trimmedGivenName; | |
| 29 | this.familyName = trimmedFamilyName; | |
| 30 | this.nationality = nationality; | |
| 31 | } | |
| 32 | ||
| 33 | private static String trim(String str) { | |
| 34 | String output = str.trim().replaceAll("\\s+", " "); | |
| 35 | String[] parts = output.split(" "); | |
| 36 | ||
| 37 | StringBuilder sb = new StringBuilder(); | |
| 38 | for (String part : parts) { | |
| 39 |
2
1. trim : removed conditional - replaced equality check with false → KILLED 2. trim : removed conditional - replaced equality check with true → KILLED |
if (!sb.isEmpty()) sb.append(" "); |
| 40 | sb.append(part); | |
| 41 | } | |
| 42 |
1
1. trim : replaced return value with "" for com/seshira/events/person/domain/models/Person::trim → KILLED |
return sb.toString(); |
| 43 | } | |
| 44 | } | |
Mutations | ||
| 27 |
1.1 |
|
| 39 |
1.1 2.2 |
|
| 42 |
1.1 |