You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "devinsong77 (via GitHub)" <gi...@apache.org> on 2023/08/06 08:17:32 UTC

[GitHub] [shenyu] devinsong77 opened a new pull request, #4965: [type:test][ISSUE #4540] add test cases for shenyu.admin.model.event.role

devinsong77 opened a new pull request, #4965:
URL: https://github.com/apache/shenyu/pull/4965

   add test cases for shenyu.admin.model.event.role (#4540)
   
   <!-- Describe your PR here; eg. Fixes #issueNo -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your changes.
   - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`.
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] 847850277 commented on a diff in pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "847850277 (via GitHub)" <gi...@apache.org>.
847850277 commented on code in PR #4965:
URL: https://github.com/apache/shenyu/pull/4965#discussion_r1292317322


##########
shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/role/BatchRoleDeletedEventTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.shenyu.admin.model.event.role;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.BaseDO;
+import org.apache.shenyu.admin.model.entity.RoleDO;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchRoleDeletedEvent}.
+ */
+public class BatchRoleDeletedEventTest {
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventTest;
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventEmptySourceTest;
+
+    private List<RoleDO> roleDOList;
+
+    private List<RoleDO> emptyRoleDOList;
+
+    @BeforeEach
+    public void setUp() {
+        roleDOList = batchInsertRoleDO();
+        emptyRoleDOList = new ArrayList<>();
+        batchRoleDeletedEventTest = new BatchRoleDeletedEvent(roleDOList, "test-op");
+        batchRoleDeletedEventEmptySourceTest = new BatchRoleDeletedEvent(emptyRoleDOList, "test-op");
+    }
+
+    @Test
+    public void buildContext() {

Review Comment:
   Thank you for your contribution,please add my wechat `zhengpengde-wx`



##########
shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/role/BatchRoleDeletedEventTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.shenyu.admin.model.event.role;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.BaseDO;
+import org.apache.shenyu.admin.model.entity.RoleDO;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchRoleDeletedEvent}.
+ */
+public class BatchRoleDeletedEventTest {
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventTest;
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventEmptySourceTest;
+
+    private List<RoleDO> roleDOList;
+
+    private List<RoleDO> emptyRoleDOList;
+
+    @BeforeEach
+    public void setUp() {
+        roleDOList = batchInsertRoleDO();
+        emptyRoleDOList = new ArrayList<>();
+        batchRoleDeletedEventTest = new BatchRoleDeletedEvent(roleDOList, "test-op");
+        batchRoleDeletedEventEmptySourceTest = new BatchRoleDeletedEvent(emptyRoleDOList, "test-op");
+    }
+
+    @Test
+    public void buildContext() {

Review Comment:
   Thank you for your contribution,please add my wechat `zhengpengde-wx`



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] 847850277 merged pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "847850277 (via GitHub)" <gi...@apache.org>.
847850277 merged PR #4965:
URL: https://github.com/apache/shenyu/pull/4965


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] devinsong77 commented on a diff in pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "devinsong77 (via GitHub)" <gi...@apache.org>.
devinsong77 commented on code in PR #4965:
URL: https://github.com/apache/shenyu/pull/4965#discussion_r1291453750


##########
shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/role/BatchRoleDeletedEventTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.shenyu.admin.model.event.role;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.BaseDO;
+import org.apache.shenyu.admin.model.entity.RoleDO;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchRoleDeletedEvent}.
+ */
+public class BatchRoleDeletedEventTest {
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventTest;
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventEmptySourceTest;
+
+    private List<RoleDO> roleDOList;
+
+    private List<RoleDO> emptyRoleDOList;
+
+    @BeforeEach
+    public void setUp() {
+        roleDOList = batchInsertRoleDO();
+        emptyRoleDOList = new ArrayList<>();
+        batchRoleDeletedEventTest = new BatchRoleDeletedEvent(roleDOList, "test-op");
+        batchRoleDeletedEventEmptySourceTest = new BatchRoleDeletedEvent(emptyRoleDOList, "test-op");
+    }
+
+    @Test
+    public void buildContext() {

Review Comment:
   Thank you for your suggestion, I have modified it, please review again.



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] 847850277 commented on a diff in pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "847850277 (via GitHub)" <gi...@apache.org>.
847850277 commented on code in PR #4965:
URL: https://github.com/apache/shenyu/pull/4965#discussion_r1289447926


##########
shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/role/BatchRoleDeletedEventTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.shenyu.admin.model.event.role;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.BaseDO;
+import org.apache.shenyu.admin.model.entity.RoleDO;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchRoleDeletedEvent}.
+ */
+public class BatchRoleDeletedEventTest {
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventTest;
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventEmptySourceTest;
+
+    private List<RoleDO> roleDOList;
+
+    private List<RoleDO> emptyRoleDOList;
+
+    @BeforeEach
+    public void setUp() {
+        roleDOList = batchInsertRoleDO();
+        emptyRoleDOList = new ArrayList<>();
+        batchRoleDeletedEventTest = new BatchRoleDeletedEvent(roleDOList, "test-op");
+        batchRoleDeletedEventEmptySourceTest = new BatchRoleDeletedEvent(emptyRoleDOList, "test-op");
+    }
+
+    @Test
+    public void buildContext() {

Review Comment:
   unit test name starts with test. for example
   
   ```java
   @Test
   public void testGenerateToken() {
       String token = JwtUtils.generateToken("userName", KEY);
       assertThat(token, notNullValue());
       assertThat(JwtUtils.getIssuer(token), is("userName"));
   }
   
   ```
   
   
   



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] codecov-commenter commented on pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4965:
URL: https://github.com/apache/shenyu/pull/4965#issuecomment-1672428226

   ## [Codecov](https://app.codecov.io/gh/apache/shenyu/pull/4965?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#4965](https://app.codecov.io/gh/apache/shenyu/pull/4965?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (1783be1) into [master](https://app.codecov.io/gh/apache/shenyu/commit/026b26b1ee537f3a7331b271e53154b8c50a7bd8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (026b26b) will **increase** coverage by `0.07%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 1783be1 differs from pull request most recent head e5f9729. Consider uploading reports for the commit e5f9729 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4965      +/-   ##
   ============================================
   + Coverage     63.93%   64.00%   +0.07%     
   - Complexity     8538     8545       +7     
   ============================================
     Files          1208     1208              
     Lines         35899    35886      -13     
     Branches       3217     3213       -4     
   ============================================
   + Hits          22951    22968      +17     
   + Misses        11097    11066      -31     
   - Partials       1851     1852       +1     
   ```
   
   
   [see 24 files with indirect coverage changes](https://app.codecov.io/gh/apache/shenyu/pull/4965/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] 847850277 commented on a diff in pull request #4965: [type:test][ISSUE #4540] Add test cases for shenyu.admin.model.event.role

Posted by "847850277 (via GitHub)" <gi...@apache.org>.
847850277 commented on code in PR #4965:
URL: https://github.com/apache/shenyu/pull/4965#discussion_r1289447926


##########
shenyu-admin/src/test/java/org/apache/shenyu/admin/model/event/role/BatchRoleDeletedEventTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.shenyu.admin.model.event.role;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.BaseDO;
+import org.apache.shenyu.admin.model.entity.RoleDO;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * test cast for {@link BatchRoleDeletedEvent}.
+ */
+public class BatchRoleDeletedEventTest {
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventTest;
+
+    private BatchRoleDeletedEvent batchRoleDeletedEventEmptySourceTest;
+
+    private List<RoleDO> roleDOList;
+
+    private List<RoleDO> emptyRoleDOList;
+
+    @BeforeEach
+    public void setUp() {
+        roleDOList = batchInsertRoleDO();
+        emptyRoleDOList = new ArrayList<>();
+        batchRoleDeletedEventTest = new BatchRoleDeletedEvent(roleDOList, "test-op");
+        batchRoleDeletedEventEmptySourceTest = new BatchRoleDeletedEvent(emptyRoleDOList, "test-op");
+    }
+
+    @Test
+    public void buildContext() {

Review Comment:
   unit test name starts with test. for example
   
   ```java
   @Test
   public void testGenerateToken() {
       String token = JwtUtils.generateToken("userName", KEY);
       assertThat(token, notNullValue());
       assertThat(JwtUtils.getIssuer(token), is("userName"));
   }
   
   ```
   
   all unit test show starts with test.
   
   



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org