You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/10/10 10:03:03 UTC
[GitHub] [shenyu] dragon-zhang commented on a diff in pull request #4064: [ISSUE #3808] Checking for empty parameter for plugins.
dragon-zhang commented on code in PR #4064:
URL: https://github.com/apache/shenyu/pull/4064#discussion_r991117076
##########
shenyu-common/src/test/java/org/apache/shenyu/common/utils/ParamCheckUtilsTest.java:
##########
@@ -28,11 +31,28 @@
public final class ParamCheckUtilsTest {
@Test
- public void testDubboBodyIsEmpty() {
- assertTrue(ParamCheckUtils.dubboBodyIsEmpty(null));
- assertTrue(ParamCheckUtils.dubboBodyIsEmpty(""));
- assertTrue(ParamCheckUtils.dubboBodyIsEmpty("{}"));
- assertTrue(ParamCheckUtils.dubboBodyIsEmpty("null"));
- assertFalse(ParamCheckUtils.dubboBodyIsEmpty("123"));
+ public void testBodyIsEmpty() {
+ assertTrue(ParamCheckUtils.bodyIsEmpty(null));
+ assertTrue(ParamCheckUtils.bodyIsEmpty(""));
+ assertTrue(ParamCheckUtils.bodyIsEmpty("null"));
+ assertFalse(ParamCheckUtils.bodyIsEmpty("123"));
+ }
+
+ @Test
+ public void testcheckParamsLength() {
+ try {
+ ParamCheckUtils.checkParamsLength(2, 2);
+ } catch (Exception ex) {
+ assertTrue(Objects.isNull(ex));
+ }
+ }
+
+ @Test
+ public void testcheckParamsLengthException() {
+ try {
+ ParamCheckUtils.checkParamsLength(1, 2);
+ } catch (Exception ex) {
+ assertTrue(ex instanceof ShenyuException);
+ }
Review Comment:
`org.junit.jupiter.api.Assertions#assertThrows(java.lang.Class<T>, org.junit.jupiter.api.function.Executable)` will be better.
--
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