Browse Source

hashCode 和 equals 单元测试

bugfix/10.0
yaoh.wu 5 years ago
parent
commit
578b9a8b94
  1. 13
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java

13
designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java vendored

@ -4,6 +4,7 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/** /**
* @author yaohwu * @author yaohwu
@ -11,6 +12,18 @@ import static org.junit.Assert.assertEquals;
public class RemoteWorkspaceURLTest { 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 @Test
public void testUrlReset() { public void testUrlReset() {

Loading…
Cancel
Save