From 1a7275a1e2568d2c241b6d6d840e70da3f3147b2 Mon Sep 17 00:00:00 2001 From: tmcorbin96 <115915843+tmcorbin96@users.noreply.github.com> Date: Sun, 30 Oct 2022 11:22:37 -0400 Subject: [PATCH] I have commited --- LogginLab1.iml | 16 ++++++++++++++++ pom.xml | 4 ++++ src/main/java/LogginLab.java | 4 +++- src/test/java/LogginLabTest.java | 23 +++++++++++++++++++++-- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 LogginLab1.iml diff --git a/LogginLab1.iml b/LogginLab1.iml new file mode 100644 index 0000000..eb56831 --- /dev/null +++ b/LogginLab1.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 68a484b..b24ca72 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,10 @@ test + + 19 + 19 + \ No newline at end of file diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index 11744ac..77d9a3e 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -34,4 +34,6 @@ public boolean thresholdExceeds(Integer limit) { // Write a method called thresholdReached, returns true if argument 'limit' is over the threshold. // Write a test for the method in the Test class. -} + public boolean thresholdReached(Integer limit) { return (this.threshold < limit); } +}; + diff --git a/src/test/java/LogginLabTest.java b/src/test/java/LogginLabTest.java index be1c95f..40122ba 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -21,9 +21,9 @@ public void thresholdExceeds() { LogginLab lab = new LogginLab(); lab.setThreshold(finalLimit); - for (Integer i = 1; i <= finalLimit; i++) { + for (Integer i = 1; i < finalLimit; i++) { if (lab.thresholdExceeds(i)) { - logger.log(Level.INFO, "Threshold not reached! It is "+i); + logger.log(Level.INFO, "Threshold not reached! It is " + i); assertTrue(lab.thresholdExceeds(i)); } else { logger.log(Level.INFO, "Threshold finally reached!"); @@ -31,4 +31,23 @@ public void thresholdExceeds() { } } } + + @org.junit.Test + public void thresholdReached() { + Integer finalLimit = 5; + + LogginLab lab = new LogginLab(); + lab.setThreshold(finalLimit); + + for (Integer i = 5; i == finalLimit; i++) { + if (lab.thresholdReached(i)) { + logger.log(Level.INFO, "Limit is not reached!" + i); + assertTrue(lab.thresholdReached(i)); + + } else { + logger.log(Level.INFO, "Limit finally reached!"); + assertFalse(lab.thresholdReached(i)); + } + } + } } \ No newline at end of file