Skip to content

Commit

Permalink
FAIRSPC-81: replaced two value classes with records
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreenwood committed Oct 14, 2024
1 parent 001022e commit 91ef6af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import java.util.List;

import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class SearchResultsDto {
List<SearchResultDto> results;
String query;
}
public record SearchResultsDto(List<SearchResultDto> results, String query) {}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 91ef6af

Please sign in to comment.