diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c959de7 Binary files /dev/null and b/.DS_Store differ diff --git a/LogginLab1.iml b/LogginLab1.iml new file mode 100644 index 0000000..4d11843 --- /dev/null +++ b/LogginLab1.iml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..5906f6e Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000..4bfeab7 Binary files /dev/null and b/src/main/.DS_Store differ diff --git a/src/main/java/LogginLab.class b/src/main/java/LogginLab.class new file mode 100644 index 0000000..3bf4c74 Binary files /dev/null and b/src/main/java/LogginLab.class differ diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index 0b4965f..f0398f6 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -34,6 +34,14 @@ public boolean thresholdExceeds(Integer limit) { else return false; } + + public boolean thresholdReached(Integer limit) { + + if (this.threshold < limit ) + return true; + else + return false; + } // Write a method called thresholdReached, returns true if argument 'limit' is over the threshold. // use thresholdExceeds for a pattern. diff --git a/src/test/java/LogginLabTest.java b/src/test/java/LogginLabTest.java index be1c95f..e2bd42a 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -31,4 +31,21 @@ public void thresholdExceeds() { } } } -} \ No newline at end of file + @org.junit.Test + public void thresholdReached() { + Integer finalLimit = 5; + + LogginLab lab = new LogginLab(); + lab.setThreshold(finalLimit); + + for (Integer i = 1; i <= finalLimit + 1; i++) { + if (lab.thresholdReached(i)) { + logger.log(Level.INFO, "Threshold reached!"); + assertTrue(lab.thresholdReached(i)); + } else { + logger.log(Level.INFO, "Threshold not reached! It is " + i); + assertFalse(lab.thresholdReached(i)); + } + } + } +}