diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index 0b4965f..b4805d1 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..de0f44f 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -31,4 +31,21 @@ public void thresholdExceeds() { } } } + @org.junit.Test + public void thresholdReached(){ + Integer finalLimit = 5; + LogginLab lab = new LogginLab(); + lab.setThreshold(finalLimit); + + for(Integer i = 0; i<= finalLimit; i++){ + if(lab.thresholdReached(i)){ + logger.log(Level.INFO, "Limit Exceeds Threshold"); + assertTrue(lab.thresholdReached(i)); + }else{ + logger.log(Level.INFO,"Threshold not reached"); + assertFalse(lab.thresholdReached(i)); + + } + } + } } \ No newline at end of file