This is an automated email from the ASF dual-hosted git repository. huxing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push: new 8b6f445 Minor improvement on test cases: (#1507) 8b6f445 is described below commit 8b6f4456d5664f4e7f32b0e772befc4b12086aaa Author: Lei Jiang <ladd...@gmail.com> AuthorDate: Sat Apr 21 14:25:06 2018 +0800 Minor improvement on test cases: (#1507) 1. Use org.junit.Assert instead of junit.framework.Assert(@Deprecated since Junit 4) 2. Use assertTrue and other assert methods through static import to make codes easier to read --- .../alibaba/dubbo/rpc/filter/tps/StatItemTest.java | 4 ++-- .../com/alibaba/dubbo/rpc/support/RpcUtilsTest.java | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/tps/StatItemTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/tps/StatItemTest.java index d2b5065..c211af1 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/tps/StatItemTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/tps/StatItemTest.java @@ -19,8 +19,8 @@ package com.alibaba.dubbo.rpc.filter.tps; import org.junit.After; import org.junit.Test; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class StatItemTest { diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/support/RpcUtilsTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/support/RpcUtilsTest.java index bc80cf2..ec355e7 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/support/RpcUtilsTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/support/RpcUtilsTest.java @@ -21,12 +21,16 @@ import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.rpc.Invocation; import com.alibaba.dubbo.rpc.RpcInvocation; -import junit.framework.Assert; import org.junit.Test; import java.util.HashMap; import java.util.Map; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; + public class RpcUtilsTest { /** @@ -43,9 +47,9 @@ public class RpcUtilsTest { long id1 = RpcUtils.getInvocationId(inv); RpcUtils.attachInvocationIdIfAsync(url, inv); long id2 = RpcUtils.getInvocationId(inv); - Assert.assertTrue(id1 == id2); // verify if it's idempotent - Assert.assertTrue(id1 >= 0); - Assert.assertEquals("bb", attachments.get("aa")); + assertTrue(id1 == id2); // verify if it's idempotent + assertTrue(id1 >= 0); + assertEquals("bb", attachments.get("aa")); } /** @@ -57,7 +61,7 @@ public class RpcUtilsTest { URL url = URL.valueOf("dubbo://localhost/"); Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}); RpcUtils.attachInvocationIdIfAsync(url, inv); - Assert.assertNull(RpcUtils.getInvocationId(inv)); + assertNull(RpcUtils.getInvocationId(inv)); } /** @@ -69,7 +73,7 @@ public class RpcUtilsTest { URL url = URL.valueOf("dubbo://localhost/?test.async=true"); Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}); RpcUtils.attachInvocationIdIfAsync(url, inv); - Assert.assertTrue(RpcUtils.getInvocationId(inv) >= 0l); + assertTrue(RpcUtils.getInvocationId(inv) >= 0l); } /** @@ -81,7 +85,7 @@ public class RpcUtilsTest { URL url = URL.valueOf("dubbo://localhost/?test.async=true&" + Constants.AUTO_ATTACH_INVOCATIONID_KEY + "=false"); Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}); RpcUtils.attachInvocationIdIfAsync(url, inv); - Assert.assertNull(RpcUtils.getInvocationId(inv)); + assertNull(RpcUtils.getInvocationId(inv)); } /** @@ -93,6 +97,6 @@ public class RpcUtilsTest { URL url = URL.valueOf("dubbo://localhost/?" + Constants.AUTO_ATTACH_INVOCATIONID_KEY + "=true"); Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}); RpcUtils.attachInvocationIdIfAsync(url, inv); - Assert.assertNotNull(RpcUtils.getInvocationId(inv)); + assertNotNull(RpcUtils.getInvocationId(inv)); } } -- To stop receiving notification emails like this one, please contact hux...@apache.org.