Skip to content

Commit 12d088c

Browse files
committed
Restrict access modifiers for tests to default access
1 parent ae23cc1 commit 12d088c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/GcpPlatformDetectorTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@
5151
import org.mockito.Mockito;
5252

5353
@WireMockTest(httpPort = 8089)
54-
public class GcpPlatformDetectorTest {
54+
class GcpPlatformDetectorTest {
5555
private final GcpMetadataConfig mockMetadataConfig =
5656
new GcpMetadataConfig("http://localhost:8089/");
5757
private static final Map<String, String> envVars = new HashMap<>();
5858

5959
@BeforeEach
60-
public void setup() {
60+
void setup() {
6161
envVars.clear();
6262
}
6363

6464
@ParameterizedTest
6565
@NullSource
6666
@ValueSource(strings = {""})
67-
public void testGCPComputeResourceNotGCP(String projectId) {
67+
void testGCPComputeResourceNotGCP(String projectId) {
6868
GcpMetadataConfig mockMetadataConfig = Mockito.mock(GcpMetadataConfig.class);
6969
Mockito.when(mockMetadataConfig.getProjectId()).thenReturn(projectId);
7070

@@ -78,7 +78,7 @@ public void testGCPComputeResourceNotGCP(String projectId) {
7878
}
7979

8080
@Test
81-
public void testGCPComputeResourceNonGCPEndpoint() {
81+
void testGCPComputeResourceNonGCPEndpoint() {
8282
// intentionally not providing the required Metadata-Flavor header with the
8383
// request to mimic non GCP endpoint
8484
stubFor(
@@ -94,7 +94,7 @@ public void testGCPComputeResourceNonGCPEndpoint() {
9494

9595
/** Google Compute Engine Tests * */
9696
@Test
97-
public void testGCEResourceWithGCEAttributesSucceeds() {
97+
void testGCEResourceWithGCEAttributesSucceeds() {
9898
TestUtils.stubEndpoint("/project/project-id", "GCE-pid");
9999
TestUtils.stubEndpoint("/instance/zone", "country-gce_region-gce_zone");
100100
TestUtils.stubEndpoint("/instance/id", "GCE-instance-id");
@@ -123,7 +123,7 @@ public void testGCEResourceWithGCEAttributesSucceeds() {
123123

124124
/** Google Kubernetes Engine Tests * */
125125
@Test
126-
public void testGKEResourceWithGKEAttributesSucceedsLocationZone() {
126+
void testGKEResourceWithGKEAttributesSucceedsLocationZone() {
127127
envVars.put("KUBERNETES_SERVICE_HOST", "GKE-testHost");
128128
envVars.put("NAMESPACE", "GKE-testNameSpace");
129129
// Hostname can truncate pod name, so we test downward API override.
@@ -157,7 +157,7 @@ public void testGKEResourceWithGKEAttributesSucceedsLocationZone() {
157157
}
158158

159159
@Test
160-
public void testGKEResourceWithGKEAttributesSucceedsLocationRegion() {
160+
void testGKEResourceWithGKEAttributesSucceedsLocationRegion() {
161161
envVars.put("KUBERNETES_SERVICE_HOST", "GKE-testHost");
162162
envVars.put("NAMESPACE", "GKE-testNameSpace");
163163
// Hostname can truncate pod name, so we test downward API override.
@@ -193,7 +193,7 @@ public void testGKEResourceWithGKEAttributesSucceedsLocationRegion() {
193193
@ParameterizedTest
194194
@NullSource
195195
@ValueSource(strings = {"", "country", "country-region-zone-invalid"})
196-
public void testGKEResourceDetectionWithInvalidLocations(String clusterLocation) {
196+
void testGKEResourceDetectionWithInvalidLocations(String clusterLocation) {
197197
envVars.put("KUBERNETES_SERVICE_HOST", "GKE-testHost");
198198
envVars.put("NAMESPACE", "GKE-testNameSpace");
199199
// Hostname can truncate pod name, so we test downward API override.
@@ -232,7 +232,7 @@ public void testGKEResourceDetectionWithInvalidLocations(String clusterLocation)
232232

233233
/** Google Cloud Functions Tests * */
234234
@Test
235-
public void testGCFResourceWithCloudFunctionAttributesSucceeds() {
235+
void testGCFResourceWithCloudFunctionAttributesSucceeds() {
236236
// Setup GCF required env vars
237237
envVars.put("K_SERVICE", "cloud-function-hello");
238238
envVars.put("K_REVISION", "cloud-function-hello.1");
@@ -263,7 +263,7 @@ public void testGCFResourceWithCloudFunctionAttributesSucceeds() {
263263
}
264264

265265
@Test
266-
public void testGCFDetectionWhenGCRAttributesPresent() {
266+
void testGCFDetectionWhenGCRAttributesPresent() {
267267
// Setup GCF required env vars
268268
envVars.put("K_SERVICE", "cloud-function-hello");
269269
envVars.put("K_REVISION", "cloud-function-hello.1");
@@ -289,7 +289,7 @@ public void testGCFDetectionWhenGCRAttributesPresent() {
289289

290290
/** Google Cloud Run Tests (Service) * */
291291
@Test
292-
public void testGCFResourceWithCloudRunAttributesSucceeds() {
292+
void testGCFResourceWithCloudRunAttributesSucceeds() {
293293
// Setup GCR service required env vars
294294
envVars.put("K_SERVICE", "cloud-run-hello");
295295
envVars.put("K_REVISION", "cloud-run-hello.1");
@@ -321,7 +321,7 @@ public void testGCFResourceWithCloudRunAttributesSucceeds() {
321321

322322
/** Google Cloud Run Tests (Jobs) * */
323323
@Test
324-
public void testCloudRunJobResourceWithAttributesSucceeds() {
324+
void testCloudRunJobResourceWithAttributesSucceeds() {
325325
// Setup GCR Job required env vars
326326
envVars.put("CLOUD_RUN_JOB", "cloud-run-hello-job");
327327
envVars.put("CLOUD_RUN_EXECUTION", "cloud-run-hello-job-1a2b3c");
@@ -353,7 +353,7 @@ public void testCloudRunJobResourceWithAttributesSucceeds() {
353353
/** Google App Engine Tests * */
354354
@ParameterizedTest
355355
@MethodSource("provideGAEVariantEnvironmentVariable")
356-
public void testGAEResourceWithAppEngineAttributesSucceeds(
356+
void testGAEResourceWithAppEngineAttributesSucceeds(
357357
String gaeEnvironmentVar,
358358
String metadataZone,
359359
String expectedZone,

gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/TestUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
1111
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
1212

13-
public final class TestUtils {
13+
final class TestUtils {
1414
private TestUtils() {}
1515

1616
// Helper method to help stub endpoints
17-
public static void stubEndpoint(String endpointPath, String responseBody) {
17+
static void stubEndpoint(String endpointPath, String responseBody) {
1818
stubFor(
1919
get(urlEqualTo(endpointPath))
2020
.willReturn(

0 commit comments

Comments
 (0)