From 5007bf029db7b0fd01d20aef15b71af1c7702a7f Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:03:05 -0400 Subject: [PATCH 1/3] [BI-1943] - avoid unintended value collision --- .../utilities/response/ResponseUtilsIntegrationTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java index 1b5543868..8411aa285 100644 --- a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java +++ b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java @@ -108,10 +108,11 @@ public void setup() throws MissingRequiredInfoException, UnprocessableEntityExce .slope(new BigDecimal("1.1")) .build()); for(int i = 2; i < 25; i++) { + // Ensure random slope values don't overlap with hardcoded value by adding 2 to the unsigned magnitude. newLocations.add(ProgramLocationRequest.builder() .name("place"+i) .abbreviation("abbrev"+i) - .slope(new BigDecimal(((Math.random()*10)%2 == 0 ? "" : "-")+Math.random()*20.0)) + .slope(new BigDecimal(((Math.random()*10)%2 == 0 ? "" : "-")+(Math.random()*20.0 + 2.0))) .build()); } for(int i = 25; i < 31; i++) { From 7e1f6a2094c4df8356ff188742648d647d4a2fb4 Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:56:57 -0400 Subject: [PATCH 2/3] [BI-1943] - simplified --- .../utilities/response/ResponseUtilsIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java index 8411aa285..5b4b608dc 100644 --- a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java +++ b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java @@ -112,7 +112,7 @@ public void setup() throws MissingRequiredInfoException, UnprocessableEntityExce newLocations.add(ProgramLocationRequest.builder() .name("place"+i) .abbreviation("abbrev"+i) - .slope(new BigDecimal(((Math.random()*10)%2 == 0 ? "" : "-")+(Math.random()*20.0 + 2.0))) + .slope(new BigDecimal((Math.random() > 0.5 ? "" : "-")+(Math.random() + 2.0))) .build()); } for(int i = 25; i < 31; i++) { From 08ab94c4daa58d992d8108738e7aa4e0494247f5 Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:14:19 -0400 Subject: [PATCH 3/3] [BI-1943] - simplified further --- .../utilities/response/ResponseUtilsIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java index 5b4b608dc..7cd16622a 100644 --- a/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java +++ b/src/test/java/org/breedinginsight/utilities/response/ResponseUtilsIntegrationTest.java @@ -112,7 +112,7 @@ public void setup() throws MissingRequiredInfoException, UnprocessableEntityExce newLocations.add(ProgramLocationRequest.builder() .name("place"+i) .abbreviation("abbrev"+i) - .slope(new BigDecimal((Math.random() > 0.5 ? "" : "-")+(Math.random() + 2.0))) + .slope(new BigDecimal((Math.random() > 0.5 ? "" : "-")+Math.random())) .build()); } for(int i = 25; i < 31; i++) {