From 1d421c4ba68fd3cf346ad056fb70233a7d7948db Mon Sep 17 00:00:00 2001 From: smartist17 <79124739+smartist17@users.noreply.github.com> Date: Sat, 27 Feb 2021 21:52:25 -0500 Subject: [PATCH 1/2] Loggin lab updates --- .DS_Store | Bin 0 -> 6148 bytes LogginLab1.iml | 16 +++++++++++++ src/.DS_Store | Bin 0 -> 6148 bytes src/main/.DS_Store | Bin 0 -> 6148 bytes src/main/.idea/.gitignore | 0 src/main/.idea/main.iml | 9 +++++++ src/main/.idea/modules.xml | 8 +++++++ src/main/.idea/vcs.xml | 6 +++++ src/main/.idea/workspace.xml | 39 +++++++++++++++++++++++++++++++ src/main/java/LogginLab.java | 8 +++++++ src/test/.DS_Store | Bin 0 -> 6148 bytes src/test/java/LogginLabTest.java | 2 +- 12 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 LogginLab1.iml create mode 100644 src/.DS_Store create mode 100644 src/main/.DS_Store create mode 100644 src/main/.idea/.gitignore create mode 100644 src/main/.idea/main.iml create mode 100644 src/main/.idea/modules.xml create mode 100644 src/main/.idea/vcs.xml create mode 100644 src/main/.idea/workspace.xml create mode 100644 src/test/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5cc8a1037eaeda362b206b0943ee0972d53bde88 GIT binary patch literal 6148 zcmeHK!EVz)5S>j@x(-6*P^mrc1&KpcrG++!s**|5Ll2b@M&&?JYu6FA9GKbNL=7p|sGu2X_RY@D?8mLmugF039hMf+gTg-oh6Zk!fu%C=8;8(yM*si- literal 0 HcmV?d00001 diff --git a/LogginLab1.iml b/LogginLab1.iml new file mode 100644 index 0000000..4e3316b --- /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 0000000000000000000000000000000000000000..d0f7dee9d968494eaffbb06d752f2bb12ed14224 GIT binary patch literal 6148 zcmeHK!A{#i5S;~=Zcp*^-LXh)iTvpX|u@3VH-Lqw`K>TeRYh)6>jgC?5a2>V&@$&!q$ z02R-1keg3wZc_AlLNA^H&%po90Po#^&MBdciiQ3A2EL73D|QjHxO7}z$UeVLFY>Ic zI-MJ}v>ZHHd8&0&H=j2@#%E?6S4lN0d&%&adxuGNmWut(n0#g@>HBOjK54D)nW9Rv zVlcGHS$}|#4@X(iH{+fe75&oA6FZ024c$0ttxqOf+uQAMYo|MHhm&r%(+*$1+L=xp zdhO-r?!oE#)tAZF>9_ChJ187fR$d6+!4DX-1zyI(A~(fnjB$KG6%DAQYJs4i@XZq> zagUcES>OUe;K9p-V?efoe)izr+`q7Az%%f-8Q}9Fgfd2gwL^P!ps^(YFu<@C*!I^S z81eux6099!1fpCj(4{IVF_cse%B8~}Nqp_lrIWHx#ys+5B^8R2!b62NoK)n{x1Isd zz&r!XuG`}K|1I|LAL{@4B;WH4cm^I711i{$_j_29+^zQ($9HWAJ%zGxT;h^UBFYxKajk=z(Po)gzw(FhwopCd}btJ>c^}|kICHw6Tgj}Bc zVOx%Cau~J;Y8^*U2$2@)W;QpOl*;A2RjO2{d23Rw7V_5qUS&E>i|w7_VWV|-|1f!+ zK0WKb;P9a;*)%wV7ck}pj+}lN$nXYyv-nvYAu&J<5CcoVfH~U4`V!PaB@hF|!0$4E z=Ys``Xd8?*s-pu2)dB#fz^w#q_3IC4p##u17;6L%2-m5AI+dFigPYEQ>vWj6O?<3T zr!%hJ4C|OTbJL-4(|B-8g)?qzq>&gP20k-@y&p&x@BibU`+pTg12I4hEGGjzRd?z& zsLkB13svG>Yk{^vQ7|snI8OmXUBwWKS8)zh3HU8E0BwV@M(}{pkAR|q24dh(8TbIu C=UVFk literal 0 HcmV?d00001 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..d8c3c2f 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -31,6 +31,14 @@ public void setThreshold(Integer threshold) { public boolean thresholdExceeds(Integer limit) { return (this.threshold > limit); } + public boolean thresholdReached(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 0000000000000000000000000000000000000000..7bb43dbf3a7688b5f577e22f1dd92ee69260704b GIT binary patch literal 6148 zcmeHK!A`;h^UBFYxKajk=z(Po)gzw(FhwopCd}btJ>c^}|kICHw6Tgj}Bc zVOx%Cau~J;Y8^*U2$2@)W;QpOl*;A2RjO2{d23Rw7V_5qUS&E>i|w7_VWV|-|1f!+ zK0WKb;P9a;*)%wV7ck}pj+}lN$nXYyv-nvYAu&J<5CcoVfH~U4`V!PaB@hF|!0$4E z=Ys``Xd8?*s-pu2)dB#fz^w#q_3IC4p##u17;6L%2-m5AI+dFigPYEQ>vWj6O?<3T zr!%hJ4C|OTbJL-4(|B-8g)?qzq>&gP20k-@y&p&x@BibU`+pTg12I4hEGGjzRd?z& zsLkB13svG>Yk{^vQ7|snI8OmXUBwWKS8)zh3HU8E0BwV@M(}{pkAR|q24dh(8TbIu C=UVFk literal 0 HcmV?d00001 diff --git a/src/test/java/LogginLabTest.java b/src/test/java/LogginLabTest.java index be1c95f..29af6b7 100644 --- a/src/test/java/LogginLabTest.java +++ b/src/test/java/LogginLabTest.java @@ -21,7 +21,7 @@ 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); assertTrue(lab.thresholdExceeds(i)); From 7b8bea582b060e7ee2e2537c46b503d046a44138 Mon Sep 17 00:00:00 2001 From: smartist17 <79124739+smartist17@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:38:12 -0400 Subject: [PATCH 2/2] Lab complete --- LogginLab1.iml | 2 +- src/main/java/LogginLab.java | 13 ++++++------- src/test/java/LogginLabTest.java | 24 +++++++++++++++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/LogginLab1.iml b/LogginLab1.iml index 4e3316b..0ddf51c 100644 --- a/LogginLab1.iml +++ b/LogginLab1.iml @@ -1,6 +1,6 @@ - + diff --git a/src/main/java/LogginLab.java b/src/main/java/LogginLab.java index d8c3c2f..6e5489c 100644 --- a/src/main/java/LogginLab.java +++ b/src/main/java/LogginLab.java @@ -21,25 +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); - - } public boolean thresholdReached(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 29af6b7..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; @@ -23,7 +25,7 @@ public void thresholdExceeds() { 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