@@ -50,21 +50,21 @@ void testJacksonNamingOverridesConfig() throws Exception {
50
50
}
51
51
52
52
@ Test
53
- void testInvalidNamingStrategyClass () throws Exception {
53
+ void testInvalidNamingStrategyClass () {
54
54
Config config = config (SmallRyeOASConfig .SMALLRYE_PROPERTY_NAMING_STRATEGY ,
55
55
"com.fasterxml.jackson.databind.PropertyNamingStrategies$InvalidStrategy" );
56
56
assertThrows (OpenApiRuntimeException .class , () -> scan (config , NameStrategyKebab .class ));
57
57
}
58
58
59
59
@ Test
60
- void testNoValidTranslationMethods () throws Exception {
60
+ void testNoValidTranslationMethods () {
61
61
Config config = config (SmallRyeOASConfig .SMALLRYE_PROPERTY_NAMING_STRATEGY ,
62
62
NoValidTranslationMethods .class .getName ());
63
63
assertThrows (OpenApiRuntimeException .class , () -> scan (config , NameStrategyKebab .class ));
64
64
}
65
65
66
66
@ Test
67
- void testInvalidPropertyNameTranslationAttempt () throws Exception {
67
+ void testInvalidPropertyNameTranslationAttempt () {
68
68
Config config = config (SmallRyeOASConfig .SMALLRYE_PROPERTY_NAMING_STRATEGY ,
69
69
TranslationThrowsException .class .getName ());
70
70
assertThrows (OpenApiRuntimeException .class , () -> scan (config , NameStrategyBean3 .class ));
@@ -79,7 +79,7 @@ void testInvalidPropertyNameTranslationAttempt() throws Exception {
79
79
JsonbConstants .UPPER_CAMEL_CASE_WITH_SPACES + ", Simple String One|Another Field|Y|Z|SOME Value" ,
80
80
JsonbConstants .CASE_INSENSITIVE + ", simpleStringOne|anotherField|Y|z|SOMEValue"
81
81
})
82
- void testJsonbConstantStrategy (String strategy , String expectedNames ) throws Exception {
82
+ void testJsonbConstantStrategy (String strategy , String expectedNames ) {
83
83
OpenAPI result = scan (config (SmallRyeOASConfig .SMALLRYE_PROPERTY_NAMING_STRATEGY , strategy ), NameStrategyBean3 .class );
84
84
List <String > expectedNameList = Arrays .asList (expectedNames .split ("\\ |" ));
85
85
Collections .sort (expectedNameList , String ::compareToIgnoreCase );
@@ -92,6 +92,12 @@ void testJsonbConstantStrategy(String strategy, String expectedNames) throws Exc
92
92
assertEquals (expectedNameList , actualNameList );
93
93
}
94
94
95
+ @ Test
96
+ void testMethodNamePreserved () throws Exception {
97
+ OpenAPI result = scan (NameStrategyBean4 .class );
98
+ assertJsonEquals ("components.schemas.method-name-preserved.json" , result );
99
+ }
100
+
95
101
@ Schema
96
102
static class NameStrategyBean1 {
97
103
String simpleStringValue ;
@@ -119,9 +125,9 @@ static class NameStrategyKebab {
119
125
static class NameStrategyBean3 {
120
126
String simpleStringOne ;
121
127
Integer anotherField ;
122
- BigDecimal Y ;
128
+ BigDecimal Y ; // NOSONAR - naming intentional
123
129
double z ;
124
- String SOMEValue ;
130
+ String SOMEValue ; // NOSONAR - naming intentional
125
131
126
132
public String getSimpleStringOne () {
127
133
return simpleStringOne ;
@@ -144,14 +150,35 @@ public String getSOMEValue() {
144
150
}
145
151
}
146
152
147
- public static class NoValidTranslationMethods {
148
- public NoValidTranslationMethods () {
153
+ @ Schema
154
+ static class NameStrategyBean4 {
155
+ @ Schema (name = "TESTValue" , title = "Test Value" )
156
+ Integer TestValue ; // NOSONAR - naming intentional
157
+
158
+ @ Schema (name = "eValue" , title = "e-Value" )
159
+ String EValue ; // NOSONAR - naming intentional
160
+
161
+ @ Schema (description = "Property for TestValue" )
162
+ public Integer getTESTValue () {
163
+ return TestValue ;
164
+ }
165
+
166
+ @ Schema (description = "Property for e-Value" )
167
+ public String geteValue () {
168
+ return EValue ;
149
169
}
150
170
171
+ }
172
+
173
+ public static class NoValidTranslationMethods {
151
174
public String translate () {
152
175
return null ;
153
176
}
154
177
178
+ /**
179
+ * @param v1 unused, demonstrated unsuitable translate method signature
180
+ * @param v2 unused, demonstrated unsuitable translate method signature
181
+ */
155
182
public String translate (String v1 , String v2 ) {
156
183
return null ;
157
184
}
0 commit comments