2323import org .junit .jupiter .api .Test ;
2424
2525import org .springframework .boot .configurationprocessor .json .JSONArray ;
26+ import org .springframework .boot .configurationprocessor .json .JSONException ;
2627import org .springframework .boot .configurationprocessor .json .JSONObject ;
2728import org .springframework .boot .configurationprocessor .metadata .ConfigurationMetadata ;
2829import org .springframework .boot .configurationprocessor .metadata .ItemDeprecation ;
4748class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests {
4849
4950 @ Test
50- void mergingOfAdditionalProperty () throws Exception {
51+ void mergingOfAdditionalProperty () throws JSONException {
5152 ItemMetadata property = ItemMetadata .newProperty (null , "foo" , "java.lang.String" ,
5253 AdditionalMetadata .class .getName (), null , null , null , null );
5354 String additionalMetadata = buildAdditionalMetadata (property );
@@ -57,7 +58,7 @@ void mergingOfAdditionalProperty() throws Exception {
5758 }
5859
5960 @ Test
60- void mergingOfAdditionalPropertyMatchingGroup () throws Exception {
61+ void mergingOfAdditionalPropertyMatchingGroup () throws JSONException {
6162 ItemMetadata property = ItemMetadata .newProperty (null , "simple" , "java.lang.String" , null , null , null , null ,
6263 null );
6364 String additionalMetadata = buildAdditionalMetadata (property );
@@ -67,7 +68,7 @@ void mergingOfAdditionalPropertyMatchingGroup() throws Exception {
6768 }
6869
6970 @ Test
70- void mergeExistingPropertyDefaultValue () throws Exception {
71+ void mergeExistingPropertyDefaultValue () throws JSONException {
7172 ItemMetadata property = ItemMetadata .newProperty ("simple" , "flag" , null , null , null , null , true , null );
7273 String additionalMetadata = buildAdditionalMetadata (property );
7374 ConfigurationMetadata metadata = compile (additionalMetadata , SimpleProperties .class );
@@ -80,7 +81,7 @@ void mergeExistingPropertyDefaultValue() throws Exception {
8081 }
8182
8283 @ Test
83- void mergeExistingPropertyWithSeveralCandidates () throws Exception {
84+ void mergeExistingPropertyWithSeveralCandidates () throws JSONException {
8485 ItemMetadata property = ItemMetadata .newProperty ("simple" , "flag" , Boolean .class .getName (), null , null , null ,
8586 true , null );
8687 String additionalMetadata = buildAdditionalMetadata (property );
@@ -111,7 +112,7 @@ void mergeExistingPropertyWithSeveralCandidates() throws Exception {
111112 }
112113
113114 @ Test
114- void mergeExistingPropertyDescription () throws Exception {
115+ void mergeExistingPropertyDescription () throws JSONException {
115116 ItemMetadata property = ItemMetadata .newProperty ("simple" , "comparator" , null , null , null , "A nice comparator." ,
116117 null , null );
117118 String additionalMetadata = buildAdditionalMetadata (property );
@@ -123,7 +124,7 @@ void mergeExistingPropertyDescription() throws Exception {
123124 }
124125
125126 @ Test
126- void mergeExistingPropertyDeprecation () throws Exception {
127+ void mergeExistingPropertyDeprecation () throws JSONException {
127128 ItemMetadata property = ItemMetadata .newProperty ("simple" , "comparator" , null , null , null , null , null ,
128129 new ItemDeprecation ("Don't use this." , "simple.complex-comparator" , "1.2.3" , "error" ));
129130 String additionalMetadata = buildAdditionalMetadata (property );
@@ -135,7 +136,7 @@ void mergeExistingPropertyDeprecation() throws Exception {
135136 }
136137
137138 @ Test
138- void mergeExistingPropertyDeprecationOverride () throws Exception {
139+ void mergeExistingPropertyDeprecationOverride () throws JSONException {
139140 ItemMetadata property = ItemMetadata .newProperty ("singledeprecated" , "name" , null , null , null , null , null ,
140141 new ItemDeprecation ("Don't use this." , "single.name" , "1.2.3" ));
141142 String additionalMetadata = buildAdditionalMetadata (property );
@@ -147,7 +148,7 @@ void mergeExistingPropertyDeprecationOverride() throws Exception {
147148 }
148149
149150 @ Test
150- void mergeExistingPropertyDeprecationOverrideLevel () throws Exception {
151+ void mergeExistingPropertyDeprecationOverrideLevel () throws JSONException {
151152 ItemMetadata property = ItemMetadata .newProperty ("singledeprecated" , "name" , null , null , null , null , null ,
152153 new ItemDeprecation (null , null , null , "error" ));
153154 String additionalMetadata = buildAdditionalMetadata (property );
@@ -167,7 +168,7 @@ void mergeOfInvalidAdditionalMetadata() {
167168 }
168169
169170 @ Test
170- void mergingOfSimpleHint () throws Exception {
171+ void mergingOfSimpleHint () throws JSONException {
171172 String hints = buildAdditionalHints (ItemHint .newHint ("simple.the-name" ,
172173 new ItemHint .ValueHint ("boot" , "Bla bla" ), new ItemHint .ValueHint ("spring" , null )));
173174 ConfigurationMetadata metadata = compile (hints , SimpleProperties .class );
@@ -181,7 +182,7 @@ void mergingOfSimpleHint() throws Exception {
181182 }
182183
183184 @ Test
184- void mergingOfHintWithNonCanonicalName () throws Exception {
185+ void mergingOfHintWithNonCanonicalName () throws JSONException {
185186 String hints = buildAdditionalHints (
186187 ItemHint .newHint ("simple.theName" , new ItemHint .ValueHint ("boot" , "Bla bla" )));
187188 ConfigurationMetadata metadata = compile (hints , SimpleProperties .class );
@@ -194,7 +195,7 @@ void mergingOfHintWithNonCanonicalName() throws Exception {
194195 }
195196
196197 @ Test
197- void mergingOfHintWithProvider () throws Exception {
198+ void mergingOfHintWithProvider () throws JSONException {
198199 String hints = buildAdditionalHints (new ItemHint ("simple.theName" , Collections .emptyList (),
199200 Arrays .asList (new ItemHint .ValueProvider ("first" , Collections .singletonMap ("target" , "org.foo" )),
200201 new ItemHint .ValueProvider ("second" , null ))));
@@ -209,7 +210,7 @@ void mergingOfHintWithProvider() throws Exception {
209210 }
210211
211212 @ Test
212- void mergingOfAdditionalDeprecation () throws Exception {
213+ void mergingOfAdditionalDeprecation () throws JSONException {
213214 String deprecations = buildPropertyDeprecations (
214215 ItemMetadata .newProperty ("simple" , "wrongName" , "java.lang.String" , null , null , null , null ,
215216 new ItemDeprecation ("Lame name." , "simple.the-name" , "1.2.3" )));
@@ -219,7 +220,7 @@ void mergingOfAdditionalDeprecation() throws Exception {
219220 }
220221
221222 @ Test
222- void mergingOfAdditionalMetadata () throws Exception {
223+ void mergingOfAdditionalMetadata () throws JSONException {
223224 JSONObject property = new JSONObject ();
224225 property .put ("name" , "foo" );
225226 property .put ("type" , "java.lang.String" );
@@ -234,7 +235,7 @@ void mergingOfAdditionalMetadata() throws Exception {
234235 assertThat (metadata ).has (Metadata .withProperty ("foo" , String .class ).fromSource (AdditionalMetadata .class ));
235236 }
236237
237- private String buildAdditionalMetadata (ItemMetadata ... metadata ) throws Exception {
238+ private String buildAdditionalMetadata (ItemMetadata ... metadata ) throws JSONException {
238239 TestJsonConverter converter = new TestJsonConverter ();
239240 JSONObject additionalMetadata = new JSONObject ();
240241 JSONArray properties = new JSONArray ();
@@ -245,14 +246,14 @@ private String buildAdditionalMetadata(ItemMetadata... metadata) throws Exceptio
245246 return additionalMetadata .toString ();
246247 }
247248
248- private String buildAdditionalHints (ItemHint ... hints ) throws Exception {
249+ private String buildAdditionalHints (ItemHint ... hints ) throws JSONException {
249250 TestJsonConverter converter = new TestJsonConverter ();
250251 JSONObject additionalMetadata = new JSONObject ();
251252 additionalMetadata .put ("hints" , converter .toJsonArray (Arrays .asList (hints )));
252253 return additionalMetadata .toString ();
253254 }
254255
255- private String buildPropertyDeprecations (ItemMetadata ... items ) throws Exception {
256+ private String buildPropertyDeprecations (ItemMetadata ... items ) throws JSONException {
256257 JSONArray propertiesArray = new JSONArray ();
257258 for (ItemMetadata item : items ) {
258259 JSONObject jsonObject = new JSONObject ();
0 commit comments