Pil0tXia commented on code in PR #4340: URL: https://github.com/apache/eventmesh/pull/4340#discussion_r1286068457
########## eventmesh-common/src/test/java/org/apache/eventmesh/common/protocol/http/WebhookProtocolTransportObjectTest.java: ########## @@ -0,0 +1,78 @@ +/* + * 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.common.protocol.http; + +import org.apache.eventmesh.common.Constants; +import org.apache.eventmesh.common.utils.JsonUtils; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class WebhookProtocolTransportObjectTest { + + private WebhookProtocolTransportObject webhookProtocolTransportObject; + + @Before + public void setUp() { + webhookProtocolTransportObject = WebhookProtocolTransportObject.builder().build(); + } + + @Test + public void testSetCloudEventId() { + webhookProtocolTransportObject.setCloudEventId("d0b29520-2bba-11ee-877b-2b18ac132e64"); + } + Review Comment: I got you. You would like to use setters to build a `WebhookProtocolTransportObject` and test it as a whole. It's OK. However, as marked above, this is not a Unit Test, because there is no assert judgement in it. The marked snippet is purely a setter, which is a pre-test construction and preparation and should be classified under the `@Before` annotation. Each unit test should have an assert judgement. You may read https://eventmesh.apache.org/zh/community/contribute/write-unit-test for more information. -- 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]
