From 5140e3996f37bd46b51b6dc1f351f7aa8ee2674b Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Wed, 4 Dec 2024 10:39:44 -0500 Subject: [PATCH] KPMP-5700: Account for blanks --- .../RepositoryFileDataset.java | 20 +++---- .../RepositoryFileDatasetTest.java | 59 +++++++++++++++++++ 2 files changed, 69 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java index 934fd91..e6af215 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java @@ -162,7 +162,7 @@ public void setPrimaryAdjudicatedCategory(String primaryAdjudicatedCat) { } public String getKdigoStage() { - return this.kdigoStage + "(ks)"; + return this.kdigoStage.isBlank() ? this.kdigoStage: this.kdigoStage + "(ks)"; } public void setKdigoStage(String kdigoStage) { @@ -170,7 +170,7 @@ public void setKdigoStage(String kdigoStage) { } public String getBaselineEgfr() { - return this.baselineEgfr + "(eGFR)"; + return this.baselineEgfr.isBlank() ? this.baselineEgfr: this.baselineEgfr + "(eGFR)"; } public void setBaselineEgfr(String baselineEgfr) { @@ -178,7 +178,7 @@ public void setBaselineEgfr(String baselineEgfr) { } public String getProteinuria() { - return this.proteinuria + "(prot)"; + return this.proteinuria.isBlank() ? this.proteinuria: this.proteinuria + "(prot)"; } public void setProteinuria(String proteinuria) { @@ -186,7 +186,7 @@ public void setProteinuria(String proteinuria) { } public String getA1c() { - return this.a1c + "(a1c)"; + return this.a1c.isBlank() ? this.a1c: this.a1c + "(a1c)"; } public void setA1c(String a1c) { @@ -194,7 +194,7 @@ public void setA1c(String a1c) { } public String getAlbuminuria() { - return this.albuminuria + "(alb)"; + return this.albuminuria.isBlank() ? this.albuminuria: this.albuminuria + "(alb)"; } public void setAlbuminuria(String albuminuria) { @@ -202,7 +202,7 @@ public void setAlbuminuria(String albuminuria) { } public String getDiabetesHistory() { - return this.diabetesHistory + "(dh)"; + return this.diabetesHistory.isBlank() ? this.diabetesHistory: this.diabetesHistory + "(dh)"; } public void setDiabetesHistory(String diabetesHistory) { @@ -210,7 +210,7 @@ public void setDiabetesHistory(String diabetesHistory) { } public String getDiabetesDuration() { - return this.diabetesDuration + "(dd)"; + return this.diabetesDuration.isBlank() ? this.diabetesDuration: this.diabetesDuration + "(dd)"; } public void setDiabetesDuration(String diabetesDuration) { @@ -218,7 +218,7 @@ public void setDiabetesDuration(String diabetesDuration) { } public String getHypertensionHistory() { - return this.hypertensionHistory + "(hh)"; + return this.hypertensionHistory.isBlank() ? this.hypertensionHistory: this.hypertensionHistory + "(hh)"; } public void setHypertensionHistory(String hypertensionHistory) { @@ -226,7 +226,7 @@ public void setHypertensionHistory(String hypertensionHistory) { } public String getHypertensionDuration() { - return this.hypertensionDuration + "(hd)"; + return this.hypertensionDuration.isBlank() ? this.hypertensionDuration: this.hypertensionDuration + "(hd)"; } public void setHypertensionDuration(String hypertensionDuration) { @@ -234,7 +234,7 @@ public void setHypertensionDuration(String hypertensionDuration) { } public String getOnRaasBlockade() { - return this.onRaasBlockade + "(rb)"; + return this.onRaasBlockade.isBlank() ? this.onRaasBlockade: this.onRaasBlockade + "(rb)"; } public void setOnRaasBlockade(String onRaasBlockade) { diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java index 559736f..45183a5 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java @@ -123,58 +123,117 @@ public void setKdigoStage() { assertEquals("stage 11 (ks)", repositoryDataset.getKdigoStage()); } + @Test + public void setKdigoStage_whenBlank() { + repositoryDataset.setKdigoStage(""); + assertEquals("", repositoryDataset.getKdigoStage()); + } + @Test public void setBaselineEgfr() { repositoryDataset.setBaselineEgfr("13"); assertEquals("13 (eGFR)", repositoryDataset.getBaselineEgfr()); } + @Test + public void setBaselineEgfr_whenBlank() { + repositoryDataset.setBaselineEgfr(""); + assertEquals("", repositoryDataset.getBaselineEgfr()); + } + @Test public void setProteinuria() { repositoryDataset.setProteinuria("1234"); assertEquals("1234 (prot)", repositoryDataset.getProteinuria()); } + @Test + public void setProteinuria_whenBlank() { + repositoryDataset.setProteinuria(""); + assertEquals("", repositoryDataset.getProteinuria()); + } + @Test public void setA1c() { repositoryDataset.setA1c("90%"); assertEquals("90% (a1c)", repositoryDataset.getA1c()); } + @Test + public void setA1c_whenBlank() { + repositoryDataset.setA1c(""); + assertEquals("", repositoryDataset.getA1c()); + } + @Test public void setAlbuminuria() { repositoryDataset.setAlbuminuria("yup"); assertEquals("yup (alb)", repositoryDataset.getAlbuminuria()); } + @Test + public void setAlbuminuria_whenBlank() { + repositoryDataset.setAlbuminuria(""); + assertEquals("", repositoryDataset.getAlbuminuria()); + } + @Test public void setDiabetesDuration(){ repositoryDataset.setDiabetesDuration("1 years"); assertEquals("1 years (dd)", repositoryDataset.getDiabetesDuration()); } + @Test + public void setDiabetesDuration_whenBlank() { + repositoryDataset.setDiabetesDuration(""); + assertEquals("", repositoryDataset.getDiabetesDuration()); + } + @Test public void setDiabetesHistory() { repositoryDataset.setDiabetesHistory("no"); assertEquals("no (dh)", repositoryDataset.getDiabetesHistory()); } + @Test + public void setDiabetesHistory_whenBlank() { + repositoryDataset.setDiabetesHistory(""); + assertEquals("", repositoryDataset.getDiabetesHistory()); + } + @Test public void setHypertensionDuration() { repositoryDataset.setHypertensionDuration("1 years"); assertEquals("1 years (hd)", repositoryDataset.getHypertensionDuration()); } + @Test + public void setHypertensionDuration_whenBlank() { + repositoryDataset.setHypertensionDuration(""); + assertEquals("", repositoryDataset.getHypertensionDuration()); + } + @Test public void setHypertensionHistory() { repositoryDataset.setHypertensionHistory("no"); assertEquals("no (hh)", repositoryDataset.getHypertensionHistory()); } + @Test + public void setHypertensionHistory_whenBlank() { + repositoryDataset.getHypertensionHistory(); + assertEquals("", repositoryDataset.getHypertensionHistory()); + } + @Test public void setOnRaasBlockade() { repositoryDataset.setOnRaasBlockade("no"); assertEquals("no (rb)", repositoryDataset.getOnRaasBlockade()); } + @Test + public void setOnRaasBlockade_whenBlank() { + repositoryDataset.setOnRaasBlockade(""); + assertEquals("", repositoryDataset.getOnRaasBlockade()); + } } \ No newline at end of file