File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
spring-web/src/test/java/org/springframework/http Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 2828import static org .assertj .core .api .Assertions .assertThat ;
2929
3030/**
31+ * Tests for {@link HttpStatus}.
3132 * @author Arjen Poutsma
33+ * @author Brian Clozel
3234 */
3335class HttpStatusTests {
3436
@@ -109,12 +111,18 @@ void createStatusCodes() {
109111
110112
111113 @ Test
112- void fromMapToEnum () {
114+ void fromMapToEnum () throws Exception {
113115 for (Map .Entry <Integer , List <String >> entry : statusCodes .entrySet ()) {
114116 int value = entry .getKey ();
115117 HttpStatus status = HttpStatus .valueOf (value );
116118 assertThat (status .value ()).as ("Invalid value" ).isEqualTo (value );
117119 assertThat (entry .getValue ()).as ("Invalid name for [" + value + "]" ).contains (status .name ());
120+ Deprecated deprecatedAnnotation = HttpStatus .class .getField (status .name ()).getAnnotation (Deprecated .class );
121+ if (deprecatedAnnotation != null ) {
122+ assertThat (statusCodes .get (entry .getKey ()))
123+ .as ("Should not resolve deprecated enum value when non-deprecated exists" )
124+ .hasSize (1 );
125+ }
118126 }
119127 }
120128
You can’t perform that action at this time.
0 commit comments