@@ -37,19 +37,30 @@ void fromValueIsCaseInsensitive() {
3737 }
3838
3939 @ Test
40- void fromValueRejectsUnknownSeverity () {
41- assertThrows (IllegalArgumentException .class , () -> SeverityUtils .fromValue ("unknown" ));
40+ void fromValueParsesUnknownSeverity () {
41+ assertEquals (Severity .UNKNOWN , SeverityUtils .fromValue ("unknown" ));
42+ assertEquals (Severity .UNKNOWN , SeverityUtils .fromValue ("UNKNOWN" ));
43+ }
44+
45+ @ Test
46+ void fromValueRejectsInvalidSeverity () {
47+ assertThrows (IllegalArgumentException .class , () -> SeverityUtils .fromValue ("invalid" ));
48+ }
49+
50+ @ Test
51+ void fromScoreReturnsUnknownForNullInput () {
52+ assertEquals (Severity .UNKNOWN , SeverityUtils .fromScore (null ));
4253 }
4354
4455 @ Test
4556 void fromScoreMapsCvssRanges () {
46- assertEquals (Severity .LOW , SeverityUtils .fromScore (0 ));
57+ assertEquals (Severity .LOW , SeverityUtils .fromScore (0f ));
4758 assertEquals (Severity .LOW , SeverityUtils .fromScore (3.9f ));
48- assertEquals (Severity .MEDIUM , SeverityUtils .fromScore (4 ));
59+ assertEquals (Severity .MEDIUM , SeverityUtils .fromScore (4f ));
4960 assertEquals (Severity .MEDIUM , SeverityUtils .fromScore (6.9f ));
50- assertEquals (Severity .HIGH , SeverityUtils .fromScore (7 ));
61+ assertEquals (Severity .HIGH , SeverityUtils .fromScore (7f ));
5162 assertEquals (Severity .HIGH , SeverityUtils .fromScore (8.9f ));
52- assertEquals (Severity .CRITICAL , SeverityUtils .fromScore (9 ));
53- assertEquals (Severity .CRITICAL , SeverityUtils .fromScore (10 ));
63+ assertEquals (Severity .CRITICAL , SeverityUtils .fromScore (9f ));
64+ assertEquals (Severity .CRITICAL , SeverityUtils .fromScore (10f ));
5465 }
5566}
0 commit comments