liuhaoyang commented on code in PR #9620: URL: https://github.com/apache/skywalking/pull/9620#discussion_r1011953830
########## oap-server/server-receiver-plugin/skywalking-telegraf-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/telegraf/JSONConvertTest.java: ########## @@ -0,0 +1,126 @@ +/* + * 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.skywalking.oap.server.receiver.telegraf; + +import com.google.common.collect.ImmutableMap; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.Getter; +import lombok.AllArgsConstructor; +import org.apache.skywalking.oap.server.receiver.telegraf.provider.handler.TelegrafServiceHandler; +import org.apache.skywalking.oap.server.receiver.telegraf.provider.handler.pojo.TelegrafDatum; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class JSONConvertTest { Review Comment: > Could you check `ZabbixMetricsTest` and `ZabbixProtocolHandlerTest` about how to do UT? What we need to test is that, we have a JSON text(same format as telegraf reported, that could link to a doc), then, the UT calls some methods in your handler(or something here). Then we could verify the sample family with expectations. > > In the current one, you seem using a mock class to test another mock class. > > cc @kezhenxu94 I noticed that @soander added unit tests today, cc @wu-sheng -- 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]
