2323
2424import org .springframework .boot .configurationprocessor .metadata .ConfigurationMetadata ;
2525import org .springframework .boot .configurationprocessor .metadata .Metadata ;
26- import org .springframework .boot .configurationsample .Access ;
26+ import org .springframework .boot .configurationsample .TestAccess ;
2727import org .springframework .boot .configurationsample .endpoint .CamelCaseEndpoint ;
2828import org .springframework .boot .configurationsample .endpoint .CustomPropertiesEndpoint ;
2929import org .springframework .boot .configurationsample .endpoint .DisabledEndpoint ;
@@ -54,7 +54,7 @@ void simpleEndpoint() {
5454 ConfigurationMetadata metadata = compile (SimpleEndpoint .class );
5555 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.simple" ).fromSource (SimpleEndpoint .class ));
5656 assertThat (metadata ).has (enabledFlag ("simple" , true ));
57- assertThat (metadata ).has (access ("simple" , Access .UNRESTRICTED ));
57+ assertThat (metadata ).has (access ("simple" , TestAccess .UNRESTRICTED ));
5858 assertThat (metadata ).has (cacheTtl ("simple" ));
5959 assertThat (metadata .getItems ()).hasSize (4 );
6060 }
@@ -64,7 +64,7 @@ void disabledEndpoint() {
6464 ConfigurationMetadata metadata = compile (DisabledEndpoint .class );
6565 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.disabled" ).fromSource (DisabledEndpoint .class ));
6666 assertThat (metadata ).has (enabledFlag ("disabled" , false ));
67- assertThat (metadata ).has (access ("disabled" , Access .NONE ));
67+ assertThat (metadata ).has (access ("disabled" , TestAccess .NONE ));
6868 assertThat (metadata .getItems ()).hasSize (3 );
6969 }
7070
@@ -73,7 +73,7 @@ void enabledEndpoint() {
7373 ConfigurationMetadata metadata = compile (EnabledEndpoint .class );
7474 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.enabled" ).fromSource (EnabledEndpoint .class ));
7575 assertThat (metadata ).has (enabledFlag ("enabled" , true ));
76- assertThat (metadata ).has (access ("enabled" , Access .UNRESTRICTED ));
76+ assertThat (metadata ).has (access ("enabled" , TestAccess .UNRESTRICTED ));
7777 assertThat (metadata .getItems ()).hasSize (3 );
7878 }
7979
@@ -82,7 +82,7 @@ void noAccessEndpoint() {
8282 ConfigurationMetadata metadata = compile (NoAccessEndpoint .class );
8383 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.noaccess" ).fromSource (NoAccessEndpoint .class ));
8484 assertThat (metadata ).has (enabledFlag ("noaccess" , false ));
85- assertThat (metadata ).has (access ("noaccess" , Access .NONE ));
85+ assertThat (metadata ).has (access ("noaccess" , TestAccess .NONE ));
8686 assertThat (metadata .getItems ()).hasSize (3 );
8787 }
8888
@@ -92,7 +92,7 @@ void readOnlyAccessEndpoint() {
9292 assertThat (metadata )
9393 .has (Metadata .withGroup ("management.endpoint.readonlyaccess" ).fromSource (ReadOnlyAccessEndpoint .class ));
9494 assertThat (metadata ).has (enabledFlag ("readonlyaccess" , true ));
95- assertThat (metadata ).has (access ("readonlyaccess" , Access .READ_ONLY ));
95+ assertThat (metadata ).has (access ("readonlyaccess" , TestAccess .READ_ONLY ));
9696 assertThat (metadata .getItems ()).hasSize (3 );
9797 }
9898
@@ -102,7 +102,7 @@ void unrestrictedAccessEndpoint() {
102102 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.unrestrictedaccess" )
103103 .fromSource (UnrestrictedAccessEndpoint .class ));
104104 assertThat (metadata ).has (enabledFlag ("unrestrictedaccess" , true ));
105- assertThat (metadata ).has (access ("unrestrictedaccess" , Access .UNRESTRICTED ));
105+ assertThat (metadata ).has (access ("unrestrictedaccess" , TestAccess .UNRESTRICTED ));
106106 assertThat (metadata .getItems ()).hasSize (3 );
107107 }
108108
@@ -115,7 +115,7 @@ void customPropertiesEndpoint() {
115115 .ofType (String .class )
116116 .withDefaultValue ("test" ));
117117 assertThat (metadata ).has (enabledFlag ("customprops" , true ));
118- assertThat (metadata ).has (access ("customprops" , Access .UNRESTRICTED ));
118+ assertThat (metadata ).has (access ("customprops" , TestAccess .UNRESTRICTED ));
119119 assertThat (metadata ).has (cacheTtl ("customprops" ));
120120 assertThat (metadata .getItems ()).hasSize (5 );
121121 }
@@ -125,7 +125,7 @@ void specificEndpoint() {
125125 ConfigurationMetadata metadata = compile (SpecificEndpoint .class );
126126 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.specific" ).fromSource (SpecificEndpoint .class ));
127127 assertThat (metadata ).has (enabledFlag ("specific" , true ));
128- assertThat (metadata ).has (access ("specific" , Access .UNRESTRICTED ));
128+ assertThat (metadata ).has (access ("specific" , TestAccess .UNRESTRICTED ));
129129 assertThat (metadata ).has (cacheTtl ("specific" ));
130130 assertThat (metadata .getItems ()).hasSize (4 );
131131 }
@@ -136,7 +136,7 @@ void camelCaseEndpoint() {
136136 assertThat (metadata )
137137 .has (Metadata .withGroup ("management.endpoint.pascal-case" ).fromSource (CamelCaseEndpoint .class ));
138138 assertThat (metadata ).has (enabledFlag ("PascalCase" , "pascal-case" , true ));
139- assertThat (metadata ).has (defaultAccess ("PascalCase" , "pascal-case" , Access .UNRESTRICTED ));
139+ assertThat (metadata ).has (defaultAccess ("PascalCase" , "pascal-case" , TestAccess .UNRESTRICTED ));
140140 assertThat (metadata .getItems ()).hasSize (3 );
141141 }
142142
@@ -147,7 +147,7 @@ void incrementalEndpointBuildChangeGeneralEnabledFlag() {
147147 assertThat (metadata )
148148 .has (Metadata .withGroup ("management.endpoint.incremental" ).fromSource (IncrementalEndpoint .class ));
149149 assertThat (metadata ).has (enabledFlag ("incremental" , true ));
150- assertThat (metadata ).has (access ("incremental" , Access .UNRESTRICTED ));
150+ assertThat (metadata ).has (access ("incremental" , TestAccess .UNRESTRICTED ));
151151 assertThat (metadata ).has (cacheTtl ("incremental" ));
152152 assertThat (metadata .getItems ()).hasSize (4 );
153153 project .replaceText (IncrementalEndpoint .class , "id = \" incremental\" " ,
@@ -156,7 +156,7 @@ void incrementalEndpointBuildChangeGeneralEnabledFlag() {
156156 assertThat (metadata )
157157 .has (Metadata .withGroup ("management.endpoint.incremental" ).fromSource (IncrementalEndpoint .class ));
158158 assertThat (metadata ).has (enabledFlag ("incremental" , false ));
159- assertThat (metadata ).has (access ("incremental" , Access .NONE ));
159+ assertThat (metadata ).has (access ("incremental" , TestAccess .NONE ));
160160 assertThat (metadata ).has (cacheTtl ("incremental" ));
161161 assertThat (metadata .getItems ()).hasSize (4 );
162162 }
@@ -168,15 +168,15 @@ void incrementalEndpointBuildChangeCacheFlag() {
168168 assertThat (metadata )
169169 .has (Metadata .withGroup ("management.endpoint.incremental" ).fromSource (IncrementalEndpoint .class ));
170170 assertThat (metadata ).has (enabledFlag ("incremental" , true ));
171- assertThat (metadata ).has (access ("incremental" , Access .UNRESTRICTED ));
171+ assertThat (metadata ).has (access ("incremental" , TestAccess .UNRESTRICTED ));
172172 assertThat (metadata ).has (cacheTtl ("incremental" ));
173173 assertThat (metadata .getItems ()).hasSize (4 );
174174 project .replaceText (IncrementalEndpoint .class , "@Nullable String param" , "String param" );
175175 metadata = project .compile ();
176176 assertThat (metadata )
177177 .has (Metadata .withGroup ("management.endpoint.incremental" ).fromSource (IncrementalEndpoint .class ));
178178 assertThat (metadata ).has (enabledFlag ("incremental" , true ));
179- assertThat (metadata ).has (access ("incremental" , Access .UNRESTRICTED ));
179+ assertThat (metadata ).has (access ("incremental" , TestAccess .UNRESTRICTED ));
180180 assertThat (metadata .getItems ()).hasSize (3 );
181181 }
182182
@@ -186,14 +186,14 @@ void incrementalEndpointBuildEnableSpecificEndpoint() {
186186 ConfigurationMetadata metadata = project .compile ();
187187 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.specific" ).fromSource (SpecificEndpoint .class ));
188188 assertThat (metadata ).has (enabledFlag ("specific" , true ));
189- assertThat (metadata ).has (access ("specific" , Access .UNRESTRICTED ));
189+ assertThat (metadata ).has (access ("specific" , TestAccess .UNRESTRICTED ));
190190 assertThat (metadata ).has (cacheTtl ("specific" ));
191191 assertThat (metadata .getItems ()).hasSize (4 );
192192 project .replaceText (SpecificEndpoint .class , "enableByDefault = true" , "enableByDefault = false" );
193193 metadata = project .compile ();
194194 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.specific" ).fromSource (SpecificEndpoint .class ));
195195 assertThat (metadata ).has (enabledFlag ("specific" , false ));
196- assertThat (metadata ).has (access ("specific" , Access .NONE ));
196+ assertThat (metadata ).has (access ("specific" , TestAccess .NONE ));
197197 assertThat (metadata ).has (cacheTtl ("specific" ));
198198 assertThat (metadata .getItems ()).hasSize (4 );
199199 }
@@ -203,7 +203,7 @@ void shouldTolerateEndpointWithSameId() {
203203 ConfigurationMetadata metadata = compile (SimpleEndpoint .class , SimpleEndpoint2 .class );
204204 assertThat (metadata ).has (Metadata .withGroup ("management.endpoint.simple" ).fromSource (SimpleEndpoint .class ));
205205 assertThat (metadata ).has (enabledFlag ("simple" , "simple" , true ));
206- assertThat (metadata ).has (defaultAccess ("simple" , "simple" , Access .UNRESTRICTED ));
206+ assertThat (metadata ).has (defaultAccess ("simple" , "simple" , TestAccess .UNRESTRICTED ));
207207 assertThat (metadata ).has (cacheTtl ("simple" ));
208208 assertThat (metadata .getItems ()).hasSize (4 );
209209 }
@@ -228,12 +228,12 @@ private Metadata.MetadataItemCondition enabledFlag(String endpointId, String end
228228 .withDeprecation (null , "management.endpoint.%s.access" .formatted (endpointSuffix ), "3.4.0" );
229229 }
230230
231- private Metadata .MetadataItemCondition access (String endpointId , Access defaultValue ) {
231+ private Metadata .MetadataItemCondition access (String endpointId , TestAccess defaultValue ) {
232232 return defaultAccess (endpointId , endpointId , defaultValue );
233233 }
234234
235235 private Metadata .MetadataItemCondition defaultAccess (String endpointId , String endpointSuffix ,
236- Access defaultValue ) {
236+ TestAccess defaultValue ) {
237237 return Metadata .withAccess ("management.endpoint." + endpointSuffix + ".access" )
238238 .withDefaultValue (defaultValue .name ().toLowerCase (Locale .ENGLISH ))
239239 .withDescription ("Permitted level of access for the %s endpoint." .formatted (endpointId ));
0 commit comments