-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathLogginLabTest.java
More file actions
40 lines (32 loc) · 1.22 KB
/
LogginLabTest.java
File metadata and controls
40 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.Assert.*;
public class LogginLabTest {
private final static Logger logger = Logger.getLogger(LogginLab.class.getName());
@org.junit.Before
public void setUp() throws Exception {
}
@org.junit.After
public void tearDown() throws Exception {
}
@org.junit.Test
public void thresholdExceeds() {
Integer finalLimit = 5;
LogginLab lab = new LogginLab();
lab.setThreshold(finalLimit);
for (Integer i = 1; i <= 5; i++) {
if (lab.thresholdExceeds(i)) {
logger.log(Level.INFO, "Threshold not reached! It is "+i);
assertTrue(lab.thresholdExceeds(i));
} else if (lab.thresholdReached(i)){
logger.log(Level.INFO, "Threshold exceeded Limit!");
assertFalse(lab.thresholdExceeds(finalLimit));
} else {
logger.log(Level.INFO, "Threshold finally reached!");
assertFalse(lab.thresholdExceeds(i));
}
}
}
}
// Write a method called thresholdReached, returns true if argument 'limit' is over the threshold.
// Write a test for the method in the Test class.