Passed
Push — main ( e3287a...08aeb5 )
by Hao
03:41
created

io.github.ro4.CheckFailedException.getMessage()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
eloc 3
1
package io.github.ro4;
2
3
import org.springframework.lang.Nullable;
4
import org.springframework.util.Assert;
5
import org.springframework.validation.BindingResult;
6
7
8
@SuppressWarnings("all")
9
public class CheckFailedException extends RuntimeException {
10
11
12
    private final BindingResult bindingResult;
13
14 1
    public CheckFailedException(BindingResult bindingResult) {
15 1
        Assert.notNull(bindingResult, "BindingResult must not be null");
16 1
        this.bindingResult = bindingResult;
17 1
    }
18
19
    public final BindingResult getBindingResult() {
20
        return this.bindingResult;
21
    }
22
23
24
    /**
25
     * Returns diagnostic information about the errors held in this object.
26
     */
27
    @Override
28
    public String getMessage() {
29 1
        return this.bindingResult.toString();
30
    }
31
32
    @Override
33
    public boolean equals(@Nullable Object other) {
34
        return (this == other || this.bindingResult.equals(other));
35
    }
36
37
    @Override
38
    public int hashCode() {
39
        return this.bindingResult.hashCode();
40
    }
41
}
42