From d3c1a872e4ba78951e8de8b5474f8017b1013f6e Mon Sep 17 00:00:00 2001 From: dert1129 Date: Mon, 11 Nov 2024 14:33:50 -0500 Subject: [PATCH] fix a lot of bugs --- .../SpatialViewerDatasetDisplay.java | 4 +- .../SpatialViewerDatasetService.java | 17 +- .../SpatialViewerExternalLinkDataset.java | 11 +- .../SpatialViewerExternalLinkId.java | 32 +--- .../SpatialViewerFileDataset.java | 13 -- .../SpatialViewerFileDatasetId.java | 20 -- .../graphql/knowledge_environment.graphqls | 46 +++-- .../SpatialViewerDatasetDisplayTest.java | 1 - .../SpatialViewerDatasetServiceTest.java | 35 ++-- ...lViewerExternalLinkDatasetDisplayTest.java | 174 ++++++++++++++++++ .../SpatialViewerExternalLinkDatasetTest.java | 6 +- .../SpatialViewerExternalLinkIdTest.java | 11 +- .../SpatialViewerFileDatsetIdTest.java | 5 - 13 files changed, 240 insertions(+), 135 deletions(-) diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplay.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplay.java index bab682b..8444ecc 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplay.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplay.java @@ -58,7 +58,7 @@ public SpatialViewerDatasetDisplay(SpatialViewerFileDataset svFile){ configType = svFile.getConfigType(); imageType = svFile.getImageType(); dataType = svFile.getDataType(); - dlFileId = svFile.getId().getDlFileId(); + dlFileId = svFile.getDlFileId(); fileName = svFile.getFileName(); packageId = svFile.getPackageId(); fileSize = svFile.getFileSize(); @@ -86,7 +86,7 @@ public SpatialViewerDatasetDisplay(SpatialViewerFileDataset svFile){ race = new HashSet(); - redcapId.add(svFile.getId().getRedcapId()); + redcapId.add(svFile.getRedcapId()); if(shouldAdd(svFile.getAge())){ age.add(svFile.getAge()); } diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetService.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetService.java index affb1aa..49bdcb4 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetService.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetService.java @@ -74,9 +74,9 @@ public List getSpatialViewerDataset() throws Exception { Map displayFiles = new HashMap<>(); Map displayLinks = new HashMap<>(); for(SpatialViewerFileDataset spatialViewerFileDataset : datasetFiles){ - if(displayFiles.containsKey(spatialViewerFileDataset.getId().getDlFileId())){ + if(displayFiles.containsKey(spatialViewerFileDataset.getDlFileId())){ // update all of the list items in that display file - SpatialViewerDatasetDisplay displayFile = displayFiles.get(spatialViewerFileDataset.getId().getDlFileId()); + SpatialViewerDatasetDisplay displayFile = displayFiles.get(spatialViewerFileDataset.getDlFileId()); displayFile.addA1c(spatialViewerFileDataset.getA1c()); displayFile.addAge(spatialViewerFileDataset.getAge()); displayFile.addAlbuminuria(spatialViewerFileDataset.getAlbuminuria()); @@ -92,11 +92,11 @@ public List getSpatialViewerDataset() throws Exception { displayFile.addProteinuria(spatialViewerFileDataset.getProteinuria()); displayFile.addProtocol(spatialViewerFileDataset.getProtocol()); displayFile.addRace(spatialViewerFileDataset.getRace()); - displayFile.addRedcapId(spatialViewerFileDataset.getId().getRedcapId()); + displayFile.addRedcapId(spatialViewerFileDataset.getRedcapId()); displayFile.addSampleType(spatialViewerFileDataset.getSampleType()); displayFile.addSex(spatialViewerFileDataset.getSex()); displayFile.addTissueSource(spatialViewerFileDataset.getTissueSource()); - displayFiles.put(spatialViewerFileDataset.getId().getDlFileId(), displayFile); + displayFiles.put(spatialViewerFileDataset.getDlFileId(), displayFile); }else{ SpatialViewerDatasetDisplay displayFile = new SpatialViewerDatasetDisplay(spatialViewerFileDataset); if(Double.compare(spatialViewerFileDataset.getReleaseVersion(), maxReleaseVersion) == EQUALITY_OPERATOR){ @@ -104,18 +104,23 @@ public List getSpatialViewerDataset() throws Exception { }else { displayFile.setReleaseVersion(null); } - displayFiles.put(spatialViewerFileDataset.getId().getDlFileId(), displayFile); + displayFiles.put(spatialViewerFileDataset.getDlFileId(), displayFile); } } for(SpatialViewerExternalLinkDataset spatialViewerExternalLinkDataset : datasetLinks){ + if(displayLinks.containsKey(spatialViewerExternalLinkDataset.getDlFileId())){ + // update all of the list items in that display link + SpatialViewerExternalLinkDatasetDisplay displayLink = displayLinks.get(spatialViewerExternalLinkDataset.getDlFileId()); + // do adders + } SpatialViewerExternalLinkDatasetDisplay displayLink = new SpatialViewerExternalLinkDatasetDisplay(spatialViewerExternalLinkDataset); if(Double.compare(spatialViewerExternalLinkDataset.getReleaseVersion(), maxLinkReleaseVersion) == EQUALITY_OPERATOR){ displayLink.setReleaseVersion("Recently Released - " + recentlyReleasedDate); }else{ displayLink.setReleaseVersion(null); } - displayLinks.put(spatialViewerExternalLinkDataset.getId().getDlFileId(), displayLink); + displayLinks.put(spatialViewerExternalLinkDataset.getId().getRedcapId(), displayLink); } datasetsFinal.addAll(displayFiles.values()); datasetsFinal.addAll(displayLinks.values()); diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java index f6f6ba1..a2f33af 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java @@ -24,7 +24,6 @@ public class SpatialViewerExternalLinkDataset { private String imageType; private String dataType; private String spectrackSampleId; - private String redcapId; private int participantId; private String age; private String protocol; @@ -33,6 +32,7 @@ public class SpatialViewerExternalLinkDataset { private String tissueSource; private String enrollmentCategory; private Double releaseVersion; + @Column(name = "primary_adjudicated_cat") private String primaryAdjudicatedCategory; private String kdigoStage; private String baselineEgfr; @@ -196,15 +196,6 @@ public void setSpectrackSampleId(String spectrackSampleId) { } - public String getRedcapId() { - return redcapId; - } - - public void setRedcapId(String redcapId) { - this.redcapId = redcapId; - } - - public int getParticipantId() { return participantId; } diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java index d532d38..ab188d9 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java @@ -2,23 +2,11 @@ import java.io.Serializable; -import jakarta.persistence.Column; +// import jakarta.persistence.Column; import jakarta.persistence.Embeddable; @Embeddable public class SpatialViewerExternalLinkId implements Serializable{ - private String dlFileId; private String redcapId; - private String experimentalStrategy; - private String doi; - - @Column(name = "dl_file_id") - public String getDlFileId() { - return this.dlFileId; - } - - public void setDlFileId(String dlFileId) { - this.dlFileId = dlFileId; - } public String getRedcapId() { return this.redcapId; @@ -27,22 +15,4 @@ public String getRedcapId() { public void setRedcapId(String redcapId) { this.redcapId = redcapId; } - - public String getExperimentalStrategy() { - return this.experimentalStrategy; - } - - public void setExperimentalStrategy(String experimentalStrategy) { - this.experimentalStrategy = experimentalStrategy; - } - - public String getDoi() { - return this.doi; - } - - public void setDoi(String doi) { - if (doi != null && !doi.isEmpty()){ - this.doi = doi; - } - } } diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDataset.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDataset.java index b15d045..55da9a0 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDataset.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDataset.java @@ -20,10 +20,6 @@ @Table(name = "sv_file_v") public class SpatialViewerFileDataset { - - - @EmbeddedId - private SpatialViewerFileDatasetId id; @Id @Column(name = "file_id") private int fileId; @@ -69,15 +65,6 @@ public class SpatialViewerFileDataset { ) @ManyToMany(fetch = FetchType.EAGER) private List relatedFiles; - - public SpatialViewerFileDatasetId getId(){ - return this.id; - } - - public void setId(SpatialViewerFileDatasetId id){ - this.id = id; - } - public int getFileId() { return fileId; diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatasetId.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatasetId.java index 588497c..24723b7 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatasetId.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatasetId.java @@ -8,8 +8,6 @@ public class SpatialViewerFileDatasetId implements Serializable{ private String dlFileId; private String redcapId; - private String experimentalStrategy; - private String doi; @Column(name = "dl_file_id") public String getDlFileId() { @@ -27,22 +25,4 @@ public String getRedcapId() { public void setRedcapId(String redcapId) { this.redcapId = redcapId; } - - public String getExperimentalStrategy() { - return this.experimentalStrategy; - } - - public void setExperimentalStrategy(String experimentalStrategy) { - this.experimentalStrategy = experimentalStrategy; - } - - public String getDoi() { - return this.doi; - } - - public void setDoi(String doi) { - if (doi != null && !doi.isEmpty()){ - this.doi = doi; - } - } } diff --git a/src/main/resources/graphql/knowledge_environment.graphqls b/src/main/resources/graphql/knowledge_environment.graphqls index 3954747..4e77a46 100644 --- a/src/main/resources/graphql/knowledge_environment.graphqls +++ b/src/main/resources/graphql/knowledge_environment.graphqls @@ -19,13 +19,13 @@ type SpatialViewerDataset { configType: String imageType: String dataType: String - redcapId: String - age: String - protocol: String + redcapId: [String] + age: [String] + protocol: [String] sampleType: String - sex: String - tissueSource: String - enrollmentCategory: String + sex: [String] + tissueSource: [String] + enrollmentCategory: [String] spectrackSampleId: String level: String # may be null relatedFiles: [File] # may be null @@ -34,6 +34,18 @@ type SpatialViewerDataset { fileNameSort: String participantIdSort: Int imageTypeSort: String + primaryAdjudicatedCategory: String + kdigoStage: String + baselineEgfr: String + proteinuria: String + a1c: String + albuminuria: String + diabetesDuration: String + diabetesHistory: String + hypertensionDuration: String + hypertensionHistory: String + race: String + onRaasBlockade: String } type SpatialViewerExternalLink { @@ -42,15 +54,27 @@ type SpatialViewerExternalLink { imageType: String dataType: String spectrackSampleId: String - redcapId: String + redcapId: [String] participantId: Int age: String - protocol: String + protocol: [String] sampleType: String - sex: String - tissueSource: String - enrollmentCategory: String + sex: [String] + tissueSource: [String] + enrollmentCategory: [String] participantIdSort: Int imageTypeSort: String releaseVersion: String + primaryAdjudicatedCategory: String + kdigoStage: String + baselineEgfr: String + proteinuria: String + a1c: String + albuminuria: String + diabetesDuration: String + diabetesHistory: String + hypertensionDuration: String + hypertensionHistory: String + race: String + onRaasBlockade: String } \ No newline at end of file diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplayTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplayTest.java index 35cfca2..74d2f85 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetDisplayTest.java @@ -28,7 +28,6 @@ public class SpatialViewerDatasetDisplayTest { public void setUp() throws Exception { MockitoAnnotations.openMocks(this); - when(spatialViewerFileDataset.getId()).thenReturn(spatialViewerFileDatasetId); spatialViewerDatasetDisplay = new SpatialViewerDatasetDisplay(spatialViewerFileDataset); } diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetServiceTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetServiceTest.java index 74754af..32203f1 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetServiceTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerDatasetServiceTest.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; @@ -68,33 +69,24 @@ public void testGetSpatialViewerFileDataset() throws JSONException, Exception { assertEquals(expectedResult, service.getSpatialViewerFileDataset()); } - @Test + @SuppressWarnings("unchecked") + @Test public void testLoadEnterpriseSearch() throws JSONException, Exception { when(env.getProperty("ES_API_TOKEN")).thenReturn("TOKEN"); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", "Bearer "+ "TOKEN"); headers.setContentType(MediaType.APPLICATION_JSON); - ArrayList results = new ArrayList<>(); - List expectedResult1 = new ArrayList<>(); - List expectedResult2 = new ArrayList<>(); - SpatialViewerExternalLinkDataset spatialViewerDataset1 = new SpatialViewerExternalLinkDataset(); - SpatialViewerExternalLinkDataset spatialViewerDataset2 = new SpatialViewerExternalLinkDataset(); - SpatialViewerFileDataset spatialViewerDataset3 = new SpatialViewerFileDataset(); - spatialViewerDataset3.setDlFileId("DlFileId"); - spatialViewerDataset3.setReleaseVersion(45.0); - SpatialViewerFileDataset spatialViewerDataset4 = new SpatialViewerFileDataset(); - spatialViewerDataset4.setReleaseVersion(34.0); - spatialViewerDataset4.setDlFileId("DlFileId2"); - expectedResult1.add(spatialViewerDataset1); - expectedResult1.add(spatialViewerDataset2); - expectedResult2.add(spatialViewerDataset3); - expectedResult2.add(spatialViewerDataset4); - when(fileRepo.max()).thenReturn(34.0); - when(externalLinkRepo.findAll()).thenReturn(expectedResult1); - when(fileRepo.findAll()).thenReturn(expectedResult2); - results.addAll(expectedResult1); - results.addAll(expectedResult2); + ArrayList results = new ArrayList<>(); + List datasetFiles = new ArrayList<>(); + List datasetLinks = new ArrayList<>(); + SpatialViewerFileDataset spatialViewerFileDataset = new SpatialViewerFileDataset(); + SpatialViewerExternalLinkDataset spatialViewerExternalLinkDataset = new SpatialViewerExternalLinkDataset(); + datasetFiles.add(spatialViewerFileDataset); + datasetLinks.add(spatialViewerExternalLinkDataset); + when(fileRepo.findAll()).thenReturn(datasetFiles); + when(externalLinkRepo.findAll()).thenReturn(datasetLinks); + HttpEntity entity = new HttpEntity<>(results, headers); SpatialViewerDatasetService.ESResponse[] esResponses = {new SpatialViewerDatasetService.ESResponse()}; @@ -102,4 +94,5 @@ public void testLoadEnterpriseSearch() throws JSONException, Exception { service.loadEnterpriseSearch(); verify(restTemplate).postForObject("host/api/as/v1/engines/search-engine/documents", entity, SpatialViewerDatasetService.ESResponse[].class); } + } diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplayTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplayTest.java index aec9133..0995525 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplayTest.java @@ -3,6 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -74,5 +78,175 @@ public void testSetReleaseVersion() { assertEquals("v1.0", spatialViewerExternalLinkDatasetDisplay.getReleaseVersion()); } + @Test + public void testSetRedcapId() { + Set expected = new HashSet(Arrays.asList("redcap_id", "redcap_id2")); + spatialViewerExternalLinkDatasetDisplay.setRedcapId(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getRedcapId(); + assertEquals(expected, actual); + } + + @Test + public void testSetAge() { + Set expected = new HashSet(Arrays.asList("30", "40")); + spatialViewerExternalLinkDatasetDisplay.setAge(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getAge(); + assertEquals(expected, actual); + } + + @Test + public void testSetProtocol() { + Set expected = new HashSet(Arrays.asList("protocol1", "protocol2")); + spatialViewerExternalLinkDatasetDisplay.setProtocol(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getProtocol(); + assertEquals(expected, actual); + } + + @Test + public void testSetSampleType() { + Set expected = new HashSet(Arrays.asList("type1", "type2")); + spatialViewerExternalLinkDatasetDisplay.setSampleType(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getSampleType(); + assertEquals(expected, actual); + } + + @Test + public void testSetSex() { + Set expected = new HashSet(Arrays.asList("male", "female")); + spatialViewerExternalLinkDatasetDisplay.setSex(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getSex(); + assertEquals(expected, actual); + } + + @Test + public void testSetTissueSource() { + Set expected = new HashSet(Arrays.asList("source1", "source2")); + spatialViewerExternalLinkDatasetDisplay.setTissueSource(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getTissueSource(); + assertEquals(expected, actual); + } + + @Test + public void testSetEnrollmentCategory() { + Set expected = new HashSet(Arrays.asList("category1", "category2")); + spatialViewerExternalLinkDatasetDisplay.setEnrollmentCategory(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getEnrollmentCategory(); + assertEquals(expected, actual); + } + + @Test + public void testSetPrimaryAdjudicatedCategory() { + Set expected = new HashSet(Arrays.asList("category1", "category2")); + spatialViewerExternalLinkDatasetDisplay.setPrimaryAdjudicatedCategory(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getPrimaryAdjudicatedCategory(); + assertEquals(expected, actual); + } + + @Test + public void testSetKdigoStage() { + Set expected = new HashSet(Arrays.asList("stage1", "stage2")); + spatialViewerExternalLinkDatasetDisplay.setKdigoStage(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getKdigoStage(); + assertEquals(expected, actual); + } + + @Test + public void testSetBaselineEgfr() { + Set expected = new HashSet(Arrays.asList("egfr1", "egfr2")); + spatialViewerExternalLinkDatasetDisplay.setBaselineEgfr(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getBaselineEgfr(); + assertEquals(expected, actual); + } + + @Test + public void testSetProteinuria() { + Set expected = new HashSet(Arrays.asList("protein1", "protein2")); + spatialViewerExternalLinkDatasetDisplay.setProteinuria(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getProteinuria(); + assertEquals(expected, actual); + } + + @Test + public void testSetA1c() { + Set expected = new HashSet(Arrays.asList("a1c1", "a1c2")); + spatialViewerExternalLinkDatasetDisplay.setA1c(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getA1c(); + assertEquals(expected, actual); + } + + @Test + public void testSetAlbuminuria() { + Set expected = new HashSet(Arrays.asList("albumin1", "albumin2")); + spatialViewerExternalLinkDatasetDisplay.setAlbuminuria(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getAlbuminuria(); + assertEquals(expected, actual); + } + + @Test + public void testSetDiabetesHistory() { + Set expected = new HashSet(Arrays.asList("history1", "history2")); + spatialViewerExternalLinkDatasetDisplay.setDiabetesHistory(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getDiabetesHistory(); + assertEquals(expected, actual); + } + + @Test + public void testSetDiabetesDuration() { + Set expected = new HashSet(Arrays.asList("duration1", "duration2")); + spatialViewerExternalLinkDatasetDisplay.setDiabetesDuration(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getDiabetesDuration(); + assertEquals(expected, actual); + } + + @Test + public void testSetHypertensionHistory() { + Set expected = new HashSet(Arrays.asList("hypertension1", "hypertension2")); + spatialViewerExternalLinkDatasetDisplay.setHypertensionHistory(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getHypertensionHistory(); + assertEquals(expected, actual); + } + + @Test + public void testSetHypertensionDuration() { + Set expected = new HashSet(Arrays.asList("duration1", "duration2")); + spatialViewerExternalLinkDatasetDisplay.setHypertensionDuration(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getHypertensionDuration(); + assertEquals(expected, actual); + } + + @Test + public void testSetOnRaasBlockade() { + Set expected = new HashSet(Arrays.asList("blockade1", "blockade2")); + spatialViewerExternalLinkDatasetDisplay.setOnRaasBlockade(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getOnRaasBlockade(); + assertEquals(expected, actual); + } + + @Test + public void testSetRace() { + Set expected = new HashSet(Arrays.asList("race1", "race2")); + spatialViewerExternalLinkDatasetDisplay.setRace(expected); + Set actual = spatialViewerExternalLinkDatasetDisplay.getRace(); + assertEquals(expected, actual); + } + + @Test + public void setParticipantIdSort() { + Set redcapIds = new HashSet(Arrays.asList("redcap_id", "redcap_id2")); + spatialViewerExternalLinkDatasetDisplay.setRedcapId(redcapIds); + spatialViewerExternalLinkDatasetDisplay.getParticipantIdSort(); + assertEquals("Multiple Participants", spatialViewerExternalLinkDatasetDisplay.getParticipantIdSort()); + } + + @Test + public void setFileNameSort() { + assertEquals(null, spatialViewerExternalLinkDatasetDisplay.getFileNameSort()); + } + @Test + public void getImageTypeSort() { + spatialViewerExternalLinkDatasetDisplay.setImageType("AbCdEf"); + assertEquals("abcdef", spatialViewerExternalLinkDatasetDisplay.getImageTypeSort()); + } + } diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetTest.java index 305d7ea..f999ee0 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetTest.java @@ -51,11 +51,7 @@ public void setSpectrackSampleId() { assertEquals("12345", spatialViewerExternalLink.getSpectrackSampleId()); } - @Test - public void setRedcapId() { - spatialViewerExternalLink.setRedcapId("12345"); - assertEquals("12345", spatialViewerExternalLink.getRedcapId()); - } + @Test public void setParticipantId() { diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkIdTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkIdTest.java index 88c9d72..ef959bd 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkIdTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkIdTest.java @@ -17,11 +17,7 @@ public void tearDown() throws Exception { spatialViewerExternalLinkId = null; } - @Test - public void setDlFileId() { - spatialViewerExternalLinkId.setDlFileId("abc_123"); - assertEquals("abc_123", spatialViewerExternalLinkId.getDlFileId()); - } + @Test public void setRedcapId() { @@ -29,9 +25,4 @@ public void setRedcapId() { assertEquals("redcap_id", spatialViewerExternalLinkId.getRedcapId()); } - @Test - public void setExperimentalStrategy() { - spatialViewerExternalLinkId.setExperimentalStrategy("stuff"); - assertEquals("stuff", spatialViewerExternalLinkId.getExperimentalStrategy()); - } } diff --git a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatsetIdTest.java b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatsetIdTest.java index e2726ff..48e4bf2 100644 --- a/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatsetIdTest.java +++ b/src/test/java/org/kpmp/spatialViewerDataset/SpatialViewerFileDatsetIdTest.java @@ -29,9 +29,4 @@ public void setRedcapId() { assertEquals("redcap_id", spatialViewerFileDatasetId.getRedcapId()); } - @Test - public void setExperimentalStrategy() { - spatialViewerFileDatasetId.setExperimentalStrategy("stuff"); - assertEquals("stuff", spatialViewerFileDatasetId.getExperimentalStrategy()); - } }