From 0846b12cb881f90b7e64c59b0f3c48fa9e81372b Mon Sep 17 00:00:00 2001 From: record-bot Date: Wed, 22 Apr 2026 12:24:06 -0700 Subject: [PATCH 1/2] record/flake: intro failure --- src/test/java/com/phalanx/calc/MathOpsTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/com/phalanx/calc/MathOpsTest.java b/src/test/java/com/phalanx/calc/MathOpsTest.java index 7b7c7c1..e7c8c18 100644 --- a/src/test/java/com/phalanx/calc/MathOpsTest.java +++ b/src/test/java/com/phalanx/calc/MathOpsTest.java @@ -3,7 +3,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import java.time.Duration; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; class MathOpsTest { @@ -61,4 +63,11 @@ void divideFractions() { void divideByZeroThrows() { assertThrows(ArithmeticException.class, () -> MathOps.divide(1, 0)); } + + @Test + @Timeout(value = 2) + void multiplyWithJitter() throws InterruptedException { + Thread.sleep((long) (Math.random() * 3000)); + assertEquals(6.0, MathOps.multiply(2, 3)); + } } From 9267bb24588612f12bd45eda3fdfdab1f9f60d8f Mon Sep 17 00:00:00 2001 From: Phalanx Date: Wed, 22 Apr 2026 19:26:13 +0000 Subject: [PATCH 2/2] Fix flaky multiply test The PR added multiplyWithJitter with a 2 second timeout but also a random sleep up to 3 seconds, making the test fail nondeterministically in CI. Remove the timing jitter and unused imports so mvn -B verify passes reliably while preserving the multiplication assertion. --- src/test/java/com/phalanx/calc/MathOpsTest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/test/java/com/phalanx/calc/MathOpsTest.java b/src/test/java/com/phalanx/calc/MathOpsTest.java index e7c8c18..82852e2 100644 --- a/src/test/java/com/phalanx/calc/MathOpsTest.java +++ b/src/test/java/com/phalanx/calc/MathOpsTest.java @@ -3,9 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import java.time.Duration; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Timeout; class MathOpsTest { @@ -65,9 +63,7 @@ void divideByZeroThrows() { } @Test - @Timeout(value = 2) - void multiplyWithJitter() throws InterruptedException { - Thread.sleep((long) (Math.random() * 3000)); + void multiplyWithJitter() { assertEquals(6.0, MathOps.multiply(2, 3)); } }