From 578b9a8b94d4fe452c710cd18cc8f31236e872c4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 27 Sep 2019 14:56:40 +0800 Subject: [PATCH] =?UTF-8?q?hashCode=20=E5=92=8C=20equals=20=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/env/RemoteWorkspaceURLTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java b/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java index 731093c153..f066ae6896 100644 --- a/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java +++ b/designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; /** * @author yaohwu @@ -11,6 +12,18 @@ import static org.junit.Assert.assertEquals; public class RemoteWorkspaceURLTest { + @Test + public void testEqualAndHashCode() { + String a = "https://yaohwu:8080/webroot/app/c/d"; + RemoteWorkspaceURL workspaceURL1 = new RemoteWorkspaceURL(a); + RemoteWorkspaceURL workspaceURL2 = new RemoteWorkspaceURL(a); + assertEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode()); + assertEquals(workspaceURL1, workspaceURL2); + workspaceURL2.resetUrl(); + assertNotEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode()); + assertNotEquals(workspaceURL1, workspaceURL2); + } + @Test public void testUrlReset() {