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
8 changes: 8 additions & 0 deletions src/main/java/LogginLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public boolean thresholdExceeds(Integer limit) {
else
return false;
}
public boolean thresholdReached(Integer limit){

if(this.threshold < limit){
return true;
}else{
return false;
}
}

// Write a method called thresholdReached, returns true if argument 'limit' is over the threshold.
// use thresholdExceeds for a pattern.
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/LogginLabTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 0; i<= finalLimit; i++){
if(lab.thresholdReached(i)){
logger.log(Level.INFO, "Limit Exceeds Threshold");
assertTrue(lab.thresholdReached(i));
}else{
logger.log(Level.INFO,"Threshold not reached");
assertFalse(lab.thresholdReached(i));

}
}
}
}