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

io.github.ro4.CheckFailedException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 5
cts 8
cp 0.625
rs 10
c 0
b 0
f 0
eloc 17
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A CheckFailedException(BindingResult) 0 3 1
A equals(Object) 0 3 1
A hashCode() 0 3 1
A getBindingResult() 0 2 1
A getMessage() 0 3 1
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