aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2023-01-10 11:51:59 +0100
committersonartech <sonartech@sonarsource.com>2023-01-12 20:02:51 +0000
commitc6a817468bcd71129f9da2b453a5a91af62df570 (patch)
tree0b20f3dd739bcb89c0e802c2d51724cbe8a7e70e /server/sonar-ce-task
parent2b61542b6a77fdfb62ff5a815856d3babee28a1a (diff)
downloadsonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.tar.gz
sonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.zip
[NO-JIRA] Use record for data classes
Diffstat (limited to 'server/sonar-ce-task')
-rw-r--r--server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java15
-rw-r--r--server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java6
2 files changed, 4 insertions, 17 deletions
diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
index 0c33e8afa42..82aed72779c 100644
--- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
+++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
@@ -59,25 +59,12 @@ public class CeTask {
}
}
- @Immutable
- public static final class User {
- private final String uuid;
- private final String login;
-
+ public record User(String uuid, String login) {
public User(String uuid, @Nullable String login) {
this.uuid = requireNonNull(uuid);
this.login = emptyToNull(login);
}
- public String getUuid() {
- return uuid;
- }
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
diff --git a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
index 65fcdc9f9ee..c773ae1c5ce 100644
--- a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
+++ b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
@@ -110,7 +110,7 @@ public class CeTaskTest {
.setSubmitter(new CeTask.User("USER_ID", ""))
.build();
- assertThat(ceTask.getSubmitter().getLogin()).isNull();
+ assertThat(ceTask.getSubmitter().login()).isNull();
}
@Test
@@ -140,8 +140,8 @@ public class CeTaskTest {
public void verify_submitter_getters() {
CeTask.User user = new CeTask.User("UUID", "LOGIN");
- assertThat(user.getUuid()).isEqualTo("UUID");
- assertThat(user.getLogin()).isEqualTo("LOGIN");
+ assertThat(user.uuid()).isEqualTo("UUID");
+ assertThat(user.login()).isEqualTo("LOGIN");
}
@Test