HoffmanZheng commented on code in PR #867: URL: https://github.com/apache/incubator-eventmesh/pull/867#discussion_r875829333
########## eventmesh-trace-plugin/eventmesh-trace-zipkin/src/test/java/org/apache/eventmesh/trace/zipkin/ZipkinTraceServiceTest.java: ########## @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.eventmesh.trace.zipkin; + +import static org.junit.Assert.assertThrows; + +import java.lang.reflect.Field; + +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; + +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.trace.SdkTracerProvider; + +public class ZipkinTraceServiceTest { + + @Test + public void testInit() throws NoSuchFieldException, IllegalAccessException { + ZipkinTraceService zipkinTraceService = new ZipkinTraceService(); + zipkinTraceService.init(); + + Field sdkTracerProviderField = ZipkinTraceService.class.getDeclaredField("sdkTracerProvider"); + Field openTelemetryField = ZipkinTraceService.class.getDeclaredField("openTelemetry"); + Field shutdownHookField = ZipkinTraceService.class.getDeclaredField("shutdownHook"); + sdkTracerProviderField.setAccessible(true); + openTelemetryField.setAccessible(true); + shutdownHookField.setAccessible(true); Review Comment: Do you mean change the modifier of these member variable from private to `protected` ? That makes sense to me, the test code located in the same package of `ZipkinTraceService `, which makes the protected member variable also accessible. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
