diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5cc8a10 Binary files /dev/null and b/.DS_Store differ diff --git a/LogginLab1.iml b/LogginLab1.iml new file mode 100644 index 0000000..0ddf51c --- /dev/null +++ b/LogginLab1.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..d0f7dee 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..7bb43db Binary files /dev/null and b/src/main/.DS_Store differ diff --git a/src/main/.idea/.gitignore b/src/main/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/main/.idea/main.iml b/src/main/.idea/main.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/src/main/.idea/main.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/.idea/modules.xml b/src/main/.idea/modules.xml new file mode 100644 index 0000000..aaf7df4 --- /dev/null +++ b/src/main/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/.idea/vcs.xml b/src/main/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/src/main/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/.idea/workspace.xml b/src/main/.idea/workspace.xml new file mode 100644 index 0000000..6dd54b0 --- /dev/null +++ b/src/main/.idea/workspace.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1614400098107 + + + + \ No newline at end of file diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index 11744ac..6e5489c 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -21,17 +21,24 @@ public static void main(String[] args) { } public Integer getThreshold() { + return threshold; } public void setThreshold(Integer threshold) { + this.threshold = threshold; } public boolean thresholdExceeds(Integer limit) { + return (this.threshold > limit); } + public boolean thresholdReached(Integer limit) {return (this.threshold < 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. -} + diff --git a/src/test/.DS_Store b/src/test/.DS_Store new file mode 100644 index 0000000..7bb43db Binary files /dev/null and b/src/test/.DS_Store differ diff --git a/src/test/java/LogginLabTest.java b/src/test/java/LogginLabTest.java index be1c95f..4aea28b 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -1,3 +1,5 @@ +import org.junit.Test; + import java.util.logging.Level; import java.util.logging.Logger; @@ -21,9 +23,9 @@ public void thresholdExceeds() { LogginLab lab = new LogginLab(); lab.setThreshold(finalLimit); - for (Integer i = 1; i <= finalLimit; i++) { + for (Integer i = 9; 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 +33,24 @@ public void thresholdExceeds() { } } } + + @Test + public void thresholdReached() { + //Given + Integer finalLimit = 10; + LogginLab lab = new LogginLab(); + lab.setThreshold(finalLimit); + + //When + for (Integer i = 20; i > finalLimit; i++) { + if (lab.thresholdReached(i)) { + assertTrue(lab.thresholdReached(i)); + } else { + + assertFalse(lab.thresholdReached(i)); + } + + + } + } } \ No newline at end of file