From 336109076e26aa1e6118bd5abac79d35c5592a8e Mon Sep 17 00:00:00 2001 From: Shadab Ahmad Date: Tue, 21 Nov 2023 11:34:53 +0000 Subject: [PATCH] address review comment --- .../org/uniprot/core/cv/xdb/impl/CrossRefEntryImpl.java | 3 ++- .../uniprot/core/cv/xdb/impl/CrossRefEntryBuilderTest.java | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core-domain/src/main/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryImpl.java b/core-domain/src/main/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryImpl.java index b71bbf198..863056340 100644 --- a/core-domain/src/main/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryImpl.java +++ b/core-domain/src/main/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryImpl.java @@ -5,6 +5,7 @@ import org.uniprot.core.Statistics; import org.uniprot.core.cv.xdb.CrossRefEntry; +import org.uniprot.core.util.Utils; public class CrossRefEntryImpl implements CrossRefEntry { @@ -42,7 +43,7 @@ public CrossRefEntryImpl( this.pubMedId = pubMedId; this.doiId = doiId; this.linkType = linkType; - this.servers = servers; + this.servers = Utils.unmodifiableList(servers); this.dbUrl = dbUrl; this.category = category; this.statistics = statistics; diff --git a/core-domain/src/test/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryBuilderTest.java b/core-domain/src/test/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryBuilderTest.java index 36d321c0b..d5d845596 100644 --- a/core-domain/src/test/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryBuilderTest.java +++ b/core-domain/src/test/java/org/uniprot/core/cv/xdb/impl/CrossRefEntryBuilderTest.java @@ -60,6 +60,13 @@ void canAdd_servers() { assertEquals(List.of(server), obj.getServers()); } + @Test + void canSet_Empty_Servers() { + CrossRefEntry obj = new CrossRefEntryBuilder().serversSet(null).build(); + assertNotNull(obj.getServers()); + assertTrue(obj.getServers().isEmpty()); + } + @Test void canSet_dbUrl() { String dbUrl = "dbUrl";