Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/LogginLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public void setThreshold(Integer 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.

}
24 changes: 22 additions & 2 deletions src/test/java/LogginLabTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import org.junit.Test;

import java.util.logging.Level;
import java.util.logging.Logger;

import static org.junit.Assert.*;

public class LogginLabTest {
public class LogginLabTest<pulbic> {
private final static Logger logger = Logger.getLogger(LogginLab.class.getName());

@org.junit.Before
Expand All @@ -14,7 +16,7 @@ public void setUp() throws Exception {
public void tearDown() throws Exception {
}

@org.junit.Test
@Test
public void thresholdExceeds() {
Integer finalLimit = 5;

Expand All @@ -31,4 +33,22 @@ public void thresholdExceeds() {
}
}
}

@Test
public void thresholdReached() {
Integer finalLimit = 5;
Integer largerLimit = 6;
LogginLab lab = new LogginLab();
lab.setThreshold(finalLimit);

for (Integer i = 1; i <= largerLimit; i++) {
if (lab.thresholdReached(i)) {
logger.log(Level.INFO, "True " + i);
assertTrue(lab.thresholdReached(i));
} else {
logger.log(Level.INFO, "False " + i);
assertFalse(lab.thresholdReached(i));
}
}
}
}