diff --git a/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultDto.java b/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultDto.java index c0dda4556..9d8620711 100644 --- a/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultDto.java +++ b/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultDto.java @@ -2,15 +2,6 @@ import lombok.Builder; import lombok.NonNull; -import lombok.Value; -@Value @Builder -public class SearchResultDto { - @NonNull - String id; - - String label; - String type; - String comment; -} +public record SearchResultDto(@NonNull String id, String label, String type, String comment) {} diff --git a/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultsDto.java b/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultsDto.java index 57850e1ee..487519236 100644 --- a/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultsDto.java +++ b/projects/saturn/src/main/java/io/fairspace/saturn/controller/dto/SearchResultsDto.java @@ -3,11 +3,6 @@ import java.util.List; import lombok.Builder; -import lombok.Value; -@Value @Builder -public class SearchResultsDto { - List results; - String query; -} +public record SearchResultsDto(List results, String query) {} diff --git a/projects/saturn/src/test/java/io/fairspace/saturn/services/search/JdbcFileSearchServiceTest.java b/projects/saturn/src/test/java/io/fairspace/saturn/services/search/JdbcFileSearchServiceTest.java index 7a36d3b45..043db9ee8 100644 --- a/projects/saturn/src/test/java/io/fairspace/saturn/services/search/JdbcFileSearchServiceTest.java +++ b/projects/saturn/src/test/java/io/fairspace/saturn/services/search/JdbcFileSearchServiceTest.java @@ -184,8 +184,8 @@ public void testSearchFiles() { var results = fileSearchService.searchFiles(request); Assert.assertEquals(2, results.size()); // Expect the results to be sorted by id - Assert.assertEquals("sample-s2-b-rna.fastq", results.get(0).getLabel()); - Assert.assertEquals("sample-s2-b-rna_copy.fastq", results.get(1).getLabel()); + Assert.assertEquals("sample-s2-b-rna.fastq", results.get(0).label()); + Assert.assertEquals("sample-s2-b-rna_copy.fastq", results.get(1).label()); } @Test @@ -199,7 +199,7 @@ public void testSearchFilesRestrictsToAccessibleCollections() { selectAdmin(); results = fileSearchService.searchFiles(request); Assert.assertEquals(1, results.size()); - Assert.assertEquals("coffee.jpg", results.getFirst().getLabel()); + Assert.assertEquals("coffee.jpg", results.getFirst().label()); } @Test @@ -214,7 +214,7 @@ public void testSearchFilesRestrictsToAccessibleCollectionsAfterReindexing() { selectAdmin(); results = fileSearchService.searchFiles(request); Assert.assertEquals(1, results.size()); - Assert.assertEquals("coffee.jpg", results.getFirst().getLabel()); + Assert.assertEquals("coffee.jpg", results.getFirst().label()); } @Test