From 9a5460c0c0e3df5c953a1c44ac2e0949c3e0ae85 Mon Sep 17 00:00:00 2001 From: Raymond Date: Fri, 25 Jun 2021 21:10:20 -0400 Subject: [PATCH] Raymond Fitzgerald --- LogginLab1.iml | 16 ++++++++++++++++ src/main/java/LogginLab.java | 4 ++++ src/test/java/LogginLabTest.java | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 LogginLab1.iml 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/main/java/LogginLab.java b/src/main/java/LogginLab.java index 11744ac..32fafa9 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -10,6 +10,8 @@ public LogginLab() { this.threshold = 0; } + + public static void main(String[] args) { logger.log(Level.INFO, "Hello World!"); @@ -32,6 +34,8 @@ 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/java/LogginLabTest.java b/src/test/java/LogginLabTest.java index be1c95f..5297ed4 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 = 1; i <= finalLimit; i++) { + if (lab.thresholdReached(i)) { + //logger.log(Level.INFO, "Threshold not reached! It is "+i); + assertTrue(lab.thresholdReached(i)); + } else { + //logger.log(Level.INFO, "Threshold finally reached!"); + assertFalse(lab.thresholdReached(i)); + } + } + } } \ No newline at end of file