From a1f95bec5c6b987035e240bb6aa9f64811266b32 Mon Sep 17 00:00:00 2001 From: Zach Date: Fri, 25 Jun 2021 17:43:23 -0400 Subject: [PATCH] method and lab --- LogginLab1.iml | 16 ++++++++++++++++ pom.xml | 12 ++++++++++++ src/main/java/LogginLab.java | 1 + src/test/java/LogginLabTest.java | 16 ++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 LogginLab1.iml diff --git a/LogginLab1.iml b/LogginLab1.iml new file mode 100644 index 0000000..3c40a7e --- /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..6c3b7f9 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,18 @@ rocks.zipcode LogginLab1 1.0-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + 11 + + + + junit diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index 11744ac..f0a81c2 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -32,6 +32,7 @@ public boolean thresholdExceeds(Integer limit) { return (this.threshold > limit); } + public boolean thresholdReached(Integer limit) { return limit > this.threshold; } // 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..8fbf81d 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -31,4 +31,20 @@ public void thresholdExceeds() { } } } + + @org.junit.Test + public void thresholdReached() { + Integer limit = 10; + + LogginLab lab = new LogginLab(); + lab.setThreshold(limit); + + for(int i = 0; i <= limit; i++){ + if(lab.thresholdReached(i)){ + assertTrue(lab.thresholdReached(i)); + } else { + assertFalse(lab.thresholdReached(i)); + } + } + } } \ No newline at end of file