@@ -55,7 +55,7 @@ class BraveAutoConfigurationTests {
55
55
.withConfiguration (AutoConfigurations .of (BraveAutoConfiguration .class ));
56
56
57
57
@ Test
58
- void shouldSupplyBraveBeans () {
58
+ void shouldSupplyDefaultBeans () {
59
59
this .contextRunner .run ((context ) -> {
60
60
assertThat (context ).hasSingleBean (Tracing .class );
61
61
assertThat (context ).hasSingleBean (Tracer .class );
@@ -65,12 +65,16 @@ void shouldSupplyBraveBeans() {
65
65
assertThat (context ).hasSingleBean (HttpTracing .class );
66
66
assertThat (context ).hasSingleBean (HttpServerHandler .class );
67
67
assertThat (context ).hasSingleBean (HttpClientHandler .class );
68
+ assertThat (context ).hasSingleBean (BraveTracer .class );
69
+ assertThat (context ).hasSingleBean (BraveBaggageManager .class );
70
+ assertThat (context ).hasSingleBean (BraveHttpServerHandler .class );
71
+ assertThat (context ).hasSingleBean (BraveHttpClientHandler .class );
68
72
});
69
73
}
70
74
71
75
@ Test
72
- void shouldBackOffOnCustomBraveBeans () {
73
- this .contextRunner .withUserConfiguration (CustomBraveConfiguration .class ).run ((context ) -> {
76
+ void shouldBackOffOnCustomBeans () {
77
+ this .contextRunner .withUserConfiguration (CustomConfiguration .class ).run ((context ) -> {
74
78
assertThat (context ).hasBean ("customTracing" );
75
79
assertThat (context ).hasSingleBean (Tracing .class );
76
80
assertThat (context ).hasBean ("customTracer" );
@@ -87,22 +91,6 @@ void shouldBackOffOnCustomBraveBeans() {
87
91
assertThat (context ).hasSingleBean (HttpServerHandler .class );
88
92
assertThat (context ).hasBean ("customHttpClientHandler" );
89
93
assertThat (context ).hasSingleBean (HttpClientHandler .class );
90
- });
91
- }
92
-
93
- @ Test
94
- void shouldSupplyMicrometerBeans () {
95
- this .contextRunner .run ((context ) -> {
96
- assertThat (context ).hasSingleBean (BraveTracer .class );
97
- assertThat (context ).hasSingleBean (BraveBaggageManager .class );
98
- assertThat (context ).hasSingleBean (BraveHttpServerHandler .class );
99
- assertThat (context ).hasSingleBean (BraveHttpClientHandler .class );
100
- });
101
- }
102
-
103
- @ Test
104
- void shouldBackOffOnCustomMicrometerBraveBeans () {
105
- this .contextRunner .withUserConfiguration (CustomMicrometerBraveConfiguration .class ).run ((context ) -> {
106
94
assertThat (context ).hasBean ("customBraveTracer" );
107
95
assertThat (context ).hasSingleBean (BraveTracer .class );
108
96
assertThat (context ).hasBean ("customBraveBaggageManager" );
@@ -115,45 +103,25 @@ void shouldBackOffOnCustomMicrometerBraveBeans() {
115
103
}
116
104
117
105
@ Test
118
- void shouldNotSupplyBraveBeansIfBraveIsMissing () {
119
- this .contextRunner .withClassLoader (new FilteredClassLoader ("brave" )).run ((context ) -> {
120
- assertThat (context ).doesNotHaveBean (Tracing .class );
121
- assertThat (context ).doesNotHaveBean (Tracer .class );
122
- assertThat (context ).doesNotHaveBean (CurrentTraceContext .class );
123
- assertThat (context ).doesNotHaveBean (Factory .class );
124
- assertThat (context ).doesNotHaveBean (Sampler .class );
125
- assertThat (context ).doesNotHaveBean (HttpTracing .class );
126
- assertThat (context ).doesNotHaveBean (HttpServerHandler .class );
127
- assertThat (context ).doesNotHaveBean (HttpClientHandler .class );
128
- });
106
+ void shouldNotSupplyBeansIfBraveIsMissing () {
107
+ this .contextRunner .withClassLoader (new FilteredClassLoader ("brave" ))
108
+ .run ((context ) -> assertThat (context ).doesNotHaveBean (BraveAutoConfiguration .class ));
129
109
}
130
110
131
111
@ Test
132
- void shouldNotSupplyMicrometerBeansIfMicrometerIsMissing () {
133
- this .contextRunner .withClassLoader (new FilteredClassLoader ("io.micrometer" )).run ((context ) -> {
134
- assertThat (context ).doesNotHaveBean (BraveTracer .class );
135
- assertThat (context ).doesNotHaveBean (BraveBaggageManager .class );
136
- assertThat (context ).doesNotHaveBean (BraveHttpServerHandler .class );
137
- assertThat (context ).doesNotHaveBean (BraveHttpClientHandler .class );
138
- });
112
+ void shouldNotSupplyBeansIfMicrometerIsMissing () {
113
+ this .contextRunner .withClassLoader (new FilteredClassLoader ("brave" ))
114
+ .run ((context ) -> assertThat (context ).doesNotHaveBean (BraveAutoConfiguration .class ));
139
115
}
140
116
141
117
@ Test
142
- void shouldNotSupplyBraveBeansIfTracingIsDisabled () {
143
- this .contextRunner .withPropertyValues ("management.tracing.enabled=false" ).run ((context ) -> {
144
- assertThat (context ).doesNotHaveBean (Tracing .class );
145
- assertThat (context ).doesNotHaveBean (Tracer .class );
146
- assertThat (context ).doesNotHaveBean (CurrentTraceContext .class );
147
- assertThat (context ).doesNotHaveBean (Factory .class );
148
- assertThat (context ).doesNotHaveBean (Sampler .class );
149
- assertThat (context ).doesNotHaveBean (HttpTracing .class );
150
- assertThat (context ).doesNotHaveBean (HttpServerHandler .class );
151
- assertThat (context ).doesNotHaveBean (HttpClientHandler .class );
152
- });
118
+ void shouldNotSupplyBeansIfTracingIsDisabled () {
119
+ this .contextRunner .withPropertyValues ("management.tracing.enabled=false" )
120
+ .run ((context ) -> assertThat (context ).doesNotHaveBean (BraveAutoConfiguration .class ));
153
121
}
154
122
155
123
@ Configuration (proxyBeanMethods = false )
156
- private static class CustomBraveConfiguration {
124
+ private static class CustomConfiguration {
157
125
158
126
@ Bean
159
127
Tracing customTracing () {
@@ -197,11 +165,6 @@ HttpClientHandler<HttpClientRequest, HttpClientResponse> customHttpClientHandler
197
165
return HttpClientHandler .create (httpTracing );
198
166
}
199
167
200
- }
201
-
202
- @ Configuration (proxyBeanMethods = false )
203
- private static class CustomMicrometerBraveConfiguration {
204
-
205
168
@ Bean
206
169
BraveTracer customBraveTracer () {
207
170
return mock (BraveTracer .class );
0 commit comments