Skip to content

Commit b3aa68c

Browse files
authored
Apply style guide section for JUnit (#2212)
1 parent 31283a3 commit b3aa68c

File tree

67 files changed

+157
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+157
-158
lines changed

aws-resources/src/test/java/io/opentelemetry/contrib/aws/resource/EksResourceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.mockito.junit.jupiter.MockitoExtension;
3535

3636
@ExtendWith(MockitoExtension.class)
37-
public class EksResourceTest {
37+
class EksResourceTest {
3838

3939
@Mock private DockerHelper mockDockerHelper;
4040

aws-xray-propagator/src/test/java/io/opentelemetry/contrib/awsxray/propagator/AwsXrayCompositePropagatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.LinkedHashMap;
1616
import org.junit.jupiter.api.Test;
1717

18-
public class AwsXrayCompositePropagatorTest extends AwsXrayPropagatorTest {
18+
class AwsXrayCompositePropagatorTest extends AwsXrayPropagatorTest {
1919

2020
@Override
2121
TextMapPropagator propagator() {

aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/AttributePropagatingSpanProcessorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void setup() {
4141
}
4242

4343
@Test
44-
public void testAttributesPropagation() {
44+
void testAttributesPropagation() {
4545
Span spanWithAppOnly = tracer.spanBuilder("parent").startSpan();
4646
spanWithAppOnly.setAttribute(testKey1, "testValue1");
4747
validateSpanAttributesInheritance(spanWithAppOnly, null, "testValue1", null);
@@ -57,7 +57,7 @@ public void testAttributesPropagation() {
5757
}
5858

5959
@Test
60-
public void testOverrideAttributes() {
60+
void testOverrideAttributes() {
6161
Span parentSpan = tracer.spanBuilder("parent").startSpan();
6262
parentSpan.setAttribute(testKey1, "testValue1");
6363
parentSpan.setAttribute(testKey2, "testValue2");
@@ -75,13 +75,13 @@ public void testOverrideAttributes() {
7575
}
7676

7777
@Test
78-
public void testAttributesDoNotExist() {
78+
void testAttributesDoNotExist() {
7979
Span span = tracer.spanBuilder("parent").startSpan();
8080
validateSpanAttributesInheritance(span, null, null, null);
8181
}
8282

8383
@Test
84-
public void testSpanNamePropagationBySpanKind() {
84+
void testSpanNamePropagationBySpanKind() {
8585
for (SpanKind value : SpanKind.values()) {
8686
Span span = tracer.spanBuilder("parent").setSpanKind(value).startSpan();
8787
if (value == SpanKind.SERVER || value == SpanKind.CONSUMER) {
@@ -93,7 +93,7 @@ public void testSpanNamePropagationBySpanKind() {
9393
}
9494

9595
@Test
96-
public void testSpanNamePropagationWithRemoteParentSpan() {
96+
void testSpanNamePropagationWithRemoteParentSpan() {
9797
Span remoteParent =
9898
Span.wrap(
9999
SpanContext.createFromRemoteParent(

aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/AwsMetricAttributeGeneratorTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void setUpMocks() {
7979
}
8080

8181
@Test
82-
public void testConsumerSpanWithoutAttributes() {
82+
void testConsumerSpanWithoutAttributes() {
8383
Attributes expectedAttributes =
8484
Attributes.of(
8585
AWS_SPAN_KIND, SpanKind.CONSUMER.name(),
@@ -89,7 +89,7 @@ public void testConsumerSpanWithoutAttributes() {
8989
}
9090

9191
@Test
92-
public void testServerSpanWithoutAttributes() {
92+
void testServerSpanWithoutAttributes() {
9393
Attributes expectedAttributes =
9494
Attributes.of(
9595
AWS_SPAN_KIND, SpanKind.SERVER.name(),
@@ -99,7 +99,7 @@ public void testServerSpanWithoutAttributes() {
9999
}
100100

101101
@Test
102-
public void testProducerSpanWithoutAttributes() {
102+
void testProducerSpanWithoutAttributes() {
103103
Attributes expectedAttributes =
104104
Attributes.of(
105105
AWS_SPAN_KIND, SpanKind.PRODUCER.name(),
@@ -111,7 +111,7 @@ public void testProducerSpanWithoutAttributes() {
111111
}
112112

113113
@Test
114-
public void testClientSpanWithoutAttributes() {
114+
void testClientSpanWithoutAttributes() {
115115
Attributes expectedAttributes =
116116
Attributes.of(
117117
AWS_SPAN_KIND, SpanKind.CLIENT.name(),
@@ -123,13 +123,13 @@ public void testClientSpanWithoutAttributes() {
123123
}
124124

125125
@Test
126-
public void testInternalSpan() {
126+
void testInternalSpan() {
127127
// Spans with internal span kind should not produce any attributes.
128128
validateAttributesProducedForSpanOfKind(Attributes.empty(), SpanKind.INTERNAL);
129129
}
130130

131131
@Test
132-
public void testConsumerSpanWithAttributes() {
132+
void testConsumerSpanWithAttributes() {
133133
updateResourceWithServiceName();
134134
when(spanDataMock.getName()).thenReturn(SPAN_NAME_VALUE);
135135

@@ -142,7 +142,7 @@ public void testConsumerSpanWithAttributes() {
142142
}
143143

144144
@Test
145-
public void testServerSpanWithAttributes() {
145+
void testServerSpanWithAttributes() {
146146
updateResourceWithServiceName();
147147
when(spanDataMock.getName()).thenReturn(SPAN_NAME_VALUE);
148148

@@ -155,7 +155,7 @@ public void testServerSpanWithAttributes() {
155155
}
156156

157157
@Test
158-
public void testServerSpanWithNullSpanName() {
158+
void testServerSpanWithNullSpanName() {
159159
updateResourceWithServiceName();
160160
when(spanDataMock.getName()).thenReturn(null);
161161

@@ -168,7 +168,7 @@ public void testServerSpanWithNullSpanName() {
168168
}
169169

170170
@Test
171-
public void testServerSpanWithSpanNameAsHttpMethod() {
171+
void testServerSpanWithSpanNameAsHttpMethod() {
172172
updateResourceWithServiceName();
173173
when(spanDataMock.getName()).thenReturn("GET");
174174
mockAttribute(HTTP_METHOD, "GET");
@@ -183,7 +183,7 @@ public void testServerSpanWithSpanNameAsHttpMethod() {
183183
}
184184

185185
@Test
186-
public void testServerSpanWithSpanNameWithHttpTarget() {
186+
void testServerSpanWithSpanNameWithHttpTarget() {
187187
updateResourceWithServiceName();
188188
when(spanDataMock.getName()).thenReturn("POST");
189189
mockAttribute(HTTP_METHOD, "POST");
@@ -203,7 +203,7 @@ public void testServerSpanWithSpanNameWithHttpTarget() {
203203
}
204204

205205
@Test
206-
public void testProducerSpanWithAttributes() {
206+
void testProducerSpanWithAttributes() {
207207
updateResourceWithServiceName();
208208
mockAttribute(AWS_LOCAL_OPERATION, AWS_LOCAL_OPERATION_VALUE);
209209
mockAttribute(AWS_REMOTE_SERVICE, AWS_REMOTE_SERVICE_VALUE);
@@ -220,7 +220,7 @@ public void testProducerSpanWithAttributes() {
220220
}
221221

222222
@Test
223-
public void testClientSpanWithAttributes() {
223+
void testClientSpanWithAttributes() {
224224
updateResourceWithServiceName();
225225
mockAttribute(AWS_LOCAL_OPERATION, AWS_LOCAL_OPERATION_VALUE);
226226
mockAttribute(AWS_REMOTE_SERVICE, AWS_REMOTE_SERVICE_VALUE);
@@ -237,7 +237,7 @@ public void testClientSpanWithAttributes() {
237237
}
238238

239239
@Test
240-
public void testRemoteAttributesCombinations() {
240+
void testRemoteAttributesCombinations() {
241241
// Set all expected fields to a test string, we will overwrite them in descending order to test
242242
// the priority-order logic in AwsMetricAttributeGenerator remote attribute methods.
243243
mockAttribute(AWS_REMOTE_SERVICE, "TestString");
@@ -333,7 +333,7 @@ public void testRemoteAttributesCombinations() {
333333
}
334334

335335
@Test
336-
public void testPeerServiceDoesOverrideOtherRemoteServices() {
336+
void testPeerServiceDoesOverrideOtherRemoteServices() {
337337
validatePeerServiceDoesOverride(RPC_SERVICE);
338338
validatePeerServiceDoesOverride(DB_SYSTEM);
339339
validatePeerServiceDoesOverride(FAAS_INVOKED_PROVIDER);
@@ -346,7 +346,7 @@ public void testPeerServiceDoesOverrideOtherRemoteServices() {
346346
}
347347

348348
@Test
349-
public void testPeerServiceDoesNotOverrideAwsRemoteService() {
349+
void testPeerServiceDoesNotOverrideAwsRemoteService() {
350350
mockAttribute(AWS_REMOTE_SERVICE, "TestString");
351351
mockAttribute(PEER_SERVICE, "PeerService");
352352

@@ -357,7 +357,7 @@ public void testPeerServiceDoesNotOverrideAwsRemoteService() {
357357
}
358358

359359
@Test
360-
public void testClientSpanWithRemoteTargetAttributes() {
360+
void testClientSpanWithRemoteTargetAttributes() {
361361
// Validate behaviour of aws bucket name attribute, then remove it.
362362
mockAttribute(AWS_BUCKET_NAME, "aws_s3_bucket_name");
363363
validateRemoteTargetAttributes(AWS_REMOTE_TARGET, "aws_s3_bucket_name");

aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/AwsMetricAttributesSpanExporterTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void setUpMocks() {
6262
}
6363

6464
@Test
65-
public void testPassthroughDelegations() {
65+
void testPassthroughDelegations() {
6666
awsMetricAttributesSpanExporter.flush();
6767
awsMetricAttributesSpanExporter.shutdown();
6868
awsMetricAttributesSpanExporter.close();
@@ -72,7 +72,7 @@ public void testPassthroughDelegations() {
7272
}
7373

7474
@Test
75-
public void testExportDelegationWithoutAttributeOrModification() {
75+
void testExportDelegationWithoutAttributeOrModification() {
7676
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
7777
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
7878
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
@@ -88,7 +88,7 @@ public void testExportDelegationWithoutAttributeOrModification() {
8888
}
8989

9090
@Test
91-
public void testExportDelegationWithAttributeButWithoutModification() {
91+
void testExportDelegationWithAttributeButWithoutModification() {
9292
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
9393
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
9494
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
@@ -104,7 +104,7 @@ public void testExportDelegationWithAttributeButWithoutModification() {
104104
}
105105

106106
@Test
107-
public void testExportDelegationWithoutAttributeButWithModification() {
107+
void testExportDelegationWithoutAttributeButWithModification() {
108108
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
109109
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
110110
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
@@ -124,7 +124,7 @@ public void testExportDelegationWithoutAttributeButWithModification() {
124124
}
125125

126126
@Test
127-
public void testExportDelegationWithAttributeAndModification() {
127+
void testExportDelegationWithAttributeAndModification() {
128128
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
129129
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
130130
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
@@ -146,7 +146,7 @@ public void testExportDelegationWithAttributeAndModification() {
146146
}
147147

148148
@Test
149-
public void testExportDelegationWithMultipleSpans() {
149+
void testExportDelegationWithMultipleSpans() {
150150
Attributes spanAttributes1 = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
151151
SpanData spanDataMock1 = buildSpanDataMock(spanAttributes1);
152152
Attributes metricAttributes1 = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
@@ -185,7 +185,7 @@ public void testExportDelegationWithMultipleSpans() {
185185
}
186186

187187
@Test
188-
public void testOverridenAttributes() {
188+
void testOverridenAttributes() {
189189
Attributes spanAttributes =
190190
Attributes.of(
191191
AttributeKey.stringKey("key1"),
@@ -217,7 +217,7 @@ public void testOverridenAttributes() {
217217
}
218218

219219
@Test
220-
public void testExportDelegatingSpanDataBehaviour() {
220+
void testExportDelegatingSpanDataBehaviour() {
221221
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
222222
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
223223
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);

aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/AwsSpanMetricsProcessorTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,21 @@ public void setUpMocks() {
101101
}
102102

103103
@Test
104-
public void testIsRequired() {
104+
void testIsRequired() {
105105
assertThat(awsSpanMetricsProcessor.isStartRequired()).isFalse();
106106
assertThat(awsSpanMetricsProcessor.isEndRequired()).isTrue();
107107
}
108108

109109
@Test
110-
public void testStartDoesNothingToSpan() {
110+
void testStartDoesNothingToSpan() {
111111
Context parentContextMock = mock(Context.class);
112112
ReadWriteSpan spanMock = mock(ReadWriteSpan.class);
113113
awsSpanMetricsProcessor.onStart(parentContextMock, spanMock);
114114
verifyNoInteractions(parentContextMock, spanMock);
115115
}
116116

117117
@Test
118-
public void testTearDown() {
118+
void testTearDown() {
119119
assertThat(awsSpanMetricsProcessor.shutdown()).isEqualTo(CompletableResultCode.ofSuccess());
120120
assertThat(awsSpanMetricsProcessor.forceFlush()).isEqualTo(CompletableResultCode.ofSuccess());
121121

@@ -128,7 +128,7 @@ public void testTearDown() {
128128
* AwsSpanMetricsProcessor's onEnd method pertaining to metrics generation.
129129
*/
130130
@Test
131-
public void testOnEndMetricsGenerationWithoutSpanAttributes() {
131+
void testOnEndMetricsGenerationWithoutSpanAttributes() {
132132
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
133133
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
134134
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
@@ -141,7 +141,7 @@ public void testOnEndMetricsGenerationWithoutSpanAttributes() {
141141
}
142142

143143
@Test
144-
public void testOnEndMetricsGenerationWithoutMetricAttributes() {
144+
void testOnEndMetricsGenerationWithoutMetricAttributes() {
145145
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 500L);
146146
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
147147
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
@@ -154,7 +154,7 @@ public void testOnEndMetricsGenerationWithoutMetricAttributes() {
154154
}
155155

156156
@Test
157-
public void testOnEndMetricsGenerationWithoutEndRequired() {
157+
void testOnEndMetricsGenerationWithoutEndRequired() {
158158
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 500L);
159159
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
160160
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
@@ -167,7 +167,7 @@ public void testOnEndMetricsGenerationWithoutEndRequired() {
167167
}
168168

169169
@Test
170-
public void testOnEndMetricsGenerationWithLatency() {
170+
void testOnEndMetricsGenerationWithLatency() {
171171
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 200L);
172172
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
173173
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
@@ -182,7 +182,7 @@ public void testOnEndMetricsGenerationWithLatency() {
182182
}
183183

184184
@Test
185-
public void testOnEndMetricsGenerationWithAwsStatusCodes() {
185+
void testOnEndMetricsGenerationWithAwsStatusCodes() {
186186
validateMetricsGeneratedForAwsStatusCode(399L, ExpectedStatusMetric.NEITHER);
187187
validateMetricsGeneratedForAwsStatusCode(400L, ExpectedStatusMetric.ERROR);
188188
validateMetricsGeneratedForAwsStatusCode(499L, ExpectedStatusMetric.ERROR);
@@ -192,7 +192,7 @@ public void testOnEndMetricsGenerationWithAwsStatusCodes() {
192192
}
193193

194194
@Test
195-
public void testOnEndMetricsGenerationWithStatusCodes() {
195+
void testOnEndMetricsGenerationWithStatusCodes() {
196196
// Invalid HTTP status codes
197197
validateMetricsGeneratedForHttpStatusCode(null, ExpectedStatusMetric.NEITHER);
198198

aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/ResourceHolderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
* Unit tests for {@link ResourceHolder}. Note that there isn't a great way to test the "default"
2222
* fallback logic, as when the test suite is run, the customize logic appears to be invoked.
2323
*/
24-
public class ResourceHolderTest {
24+
class ResourceHolderTest {
2525

2626
@Test
2727
@SuppressWarnings("unchecked")
28-
public void testCustomized() {
28+
void testCustomized() {
2929
Resource customizedResource = Resource.create(Attributes.empty());
3030
AutoConfigurationCustomizer mockCustomizer = mock(AutoConfigurationCustomizer.class);
3131
ResourceHolder resourceHolder = new ResourceHolder();

0 commit comments

Comments
 (0)