33
44package com .azure .spring .cloud .autoconfigure .implementation .eventhubs ;
55
6- import com .azure .core .credential .TokenCredential ;
76import com .azure .messaging .eventhubs .CheckpointStore ;
87import com .azure .spring .cloud .autoconfigure .implementation .eventhubs .configuration .TestCheckpointStore ;
9- import com .azure .spring .cloud .core .credential .AzureCredentialResolver ;
108import com .azure .spring .messaging .eventhubs .core .EventHubsProcessorFactory ;
119import com .azure .spring .messaging .eventhubs .core .EventHubsTemplate ;
1210import com .azure .spring .messaging .eventhubs .implementation .support .converter .EventHubsMessageConverter ;
@@ -147,15 +145,15 @@ void processorFactoryShouldConfigureCredentials() throws Exception {
147145 assertThat (context ).hasSingleBean (EventHubsProcessorFactory .class );
148146 EventHubsProcessorFactory factory = context .getBean (EventHubsProcessorFactory .class );
149147 assertThat (factory ).isInstanceOf (com .azure .spring .messaging .eventhubs .core .DefaultEventHubsNamespaceProcessorFactory .class );
150-
148+
151149 // Verify setDefaultCredential and setTokenCredentialResolver were called by checking the fields using reflection
152150 // The values may be null when using connection string auth, but the important thing is that the methods
153151 // were called and the fields exist (which they do since we successfully access them)
154152 Field defaultCredentialField = factory .getClass ().getDeclaredField ("defaultCredential" );
155153 defaultCredentialField .setAccessible (true );
156154 Object defaultCredential = defaultCredentialField .get (factory );
157155 // Field exists and is accessible, which means setDefaultCredential was called
158-
156+
159157 Field tokenCredentialResolverField = factory .getClass ().getDeclaredField ("tokenCredentialResolver" );
160158 tokenCredentialResolverField .setAccessible (true );
161159 Object resolver = tokenCredentialResolverField .get (factory );
@@ -173,18 +171,18 @@ void producerFactoryShouldConfigureCredentials() throws Exception {
173171 .withUserConfiguration (AzureEventHubsPropertiesTestConfiguration .class )
174172 .run (context -> {
175173 assertThat (context ).hasSingleBean (com .azure .spring .messaging .eventhubs .core .EventHubsProducerFactory .class );
176- com .azure .spring .messaging .eventhubs .core .EventHubsProducerFactory factory =
174+ com .azure .spring .messaging .eventhubs .core .EventHubsProducerFactory factory =
177175 context .getBean (com .azure .spring .messaging .eventhubs .core .EventHubsProducerFactory .class );
178176 assertThat (factory ).isInstanceOf (com .azure .spring .messaging .eventhubs .core .DefaultEventHubsNamespaceProducerFactory .class );
179-
177+
180178 // Verify setDefaultCredential and setTokenCredentialResolver were called by checking the fields using reflection
181179 // The values may be null when using connection string auth, but the important thing is that the methods
182180 // were called and the fields exist (which they do since we successfully access them)
183181 Field defaultCredentialField = factory .getClass ().getDeclaredField ("defaultCredential" );
184182 defaultCredentialField .setAccessible (true );
185183 Object defaultCredential = defaultCredentialField .get (factory );
186184 // Field exists and is accessible, which means setDefaultCredential was called
187-
185+
188186 Field tokenCredentialResolverField = factory .getClass ().getDeclaredField ("tokenCredentialResolver" );
189187 tokenCredentialResolverField .setAccessible (true );
190188 Object resolver = tokenCredentialResolverField .get (factory );
0 commit comments