summaryrefslogtreecommitdiff
path: root/src/main/java/testing/RuleResult.java
blob: 4414f341256011ef7fa1741892208152e4f666f4 (plain)
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
package testing;

import java.util.Collections;
import java.util.List;

/**
 * Result of applying a verification rule to simulation logs.
 */
public class RuleResult {
    private final boolean passed;
    private final String message;
    private final List<LogEntry> relevantLogs;
    
    public RuleResult(boolean passed, String message, List<LogEntry> relevantLogs) {
        this.passed = passed;
        this.message = message;
        this.relevantLogs = Collections.unmodifiableList(relevantLogs);
    }
    
    public RuleResult(boolean passed, String message) {
        this(passed, message, Collections.emptyList());
    }
    
    public boolean isPassed() {
        return passed;
    }
    
    public String getMessage() {
        return message;
    }
    
    public List<LogEntry> getRelevantLogs() {
        return relevantLogs;
    }
    
    @Override
    public String toString() {
        return (passed ? "PASS" : "FAIL") + ": " + message;
    }
}