Added toString() verification to unit tests
This commit is contained in:
parent
baf6e7c895
commit
3f579a7529
@ -39,6 +39,7 @@ class RmiGlobalTest extends BaseTest {
|
|||||||
|
|
||||||
System.err.println("Starting test for: " + remoteObjectID);
|
System.err.println("Starting test for: " + remoteObjectID);
|
||||||
|
|
||||||
|
|
||||||
//TestObject test = connection.getRemoteObject(id, TestObject.class);
|
//TestObject test = connection.getRemoteObject(id, TestObject.class);
|
||||||
assertEquals(remoteObject.hashCode(), test.hashCode());
|
assertEquals(remoteObject.hashCode(), test.hashCode());
|
||||||
RemoteObject remoteObject = (RemoteObject) test;
|
RemoteObject remoteObject = (RemoteObject) test;
|
||||||
@ -47,6 +48,13 @@ class RmiGlobalTest extends BaseTest {
|
|||||||
// (return values and exceptions are returned, call is synchronous)
|
// (return values and exceptions are returned, call is synchronous)
|
||||||
System.err.println("hashCode: " + test.hashCode());
|
System.err.println("hashCode: " + test.hashCode());
|
||||||
System.err.println("toString: " + test);
|
System.err.println("toString: " + test);
|
||||||
|
|
||||||
|
// see what the "remote" toString() method is
|
||||||
|
final String s = remoteObject.toString();
|
||||||
|
remoteObject.enableToString(true);
|
||||||
|
assertFalse(s.equals(remoteObject.toString()));
|
||||||
|
|
||||||
|
|
||||||
test.moo();
|
test.moo();
|
||||||
test.moo("Cow");
|
test.moo("Cow");
|
||||||
assertEquals(remoteObjectID, test.id());
|
assertEquals(remoteObjectID, test.id());
|
||||||
|
@ -16,7 +16,10 @@ import org.junit.Test;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
public
|
public
|
||||||
class RmiTest extends BaseTest {
|
class RmiTest extends BaseTest {
|
||||||
@ -35,16 +38,16 @@ class RmiTest extends BaseTest {
|
|||||||
//TestObject test = connection.getRemoteObject(id, TestObject.class);
|
//TestObject test = connection.getRemoteObject(id, TestObject.class);
|
||||||
RemoteObject remoteObject = (RemoteObject) test;
|
RemoteObject remoteObject = (RemoteObject) test;
|
||||||
|
|
||||||
final String s = remoteObject.toString();
|
|
||||||
remoteObject.enableToString(true);
|
|
||||||
assertFalse(s.equals(remoteObject.toString()));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Default behavior. RMI is transparent, method calls behave like normal
|
// Default behavior. RMI is transparent, method calls behave like normal
|
||||||
// (return values and exceptions are returned, call is synchronous)
|
// (return values and exceptions are returned, call is synchronous)
|
||||||
System.err.println("hashCode: " + test.hashCode());
|
System.err.println("hashCode: " + test.hashCode());
|
||||||
System.err.println("toString: " + test);
|
System.err.println("toString: " + test);
|
||||||
|
|
||||||
|
// see what the "remote" toString() method is
|
||||||
|
final String s = remoteObject.toString();
|
||||||
|
remoteObject.enableToString(true);
|
||||||
|
assertFalse(s.equals(remoteObject.toString()));
|
||||||
|
|
||||||
test.moo();
|
test.moo();
|
||||||
test.moo("Cow");
|
test.moo("Cow");
|
||||||
assertEquals(remoteObjectID, test.id());
|
assertEquals(remoteObjectID, test.id());
|
||||||
@ -164,7 +167,6 @@ class RmiTest extends BaseTest {
|
|||||||
KryoCryptoSerializationManager.DEFAULT = KryoCryptoSerializationManager.DEFAULT();
|
KryoCryptoSerializationManager.DEFAULT = KryoCryptoSerializationManager.DEFAULT();
|
||||||
register(KryoCryptoSerializationManager.DEFAULT);
|
register(KryoCryptoSerializationManager.DEFAULT);
|
||||||
|
|
||||||
|
|
||||||
Configuration configuration = new Configuration();
|
Configuration configuration = new Configuration();
|
||||||
configuration.tcpPort = tcpPort;
|
configuration.tcpPort = tcpPort;
|
||||||
configuration.udpPort = udpPort;
|
configuration.udpPort = udpPort;
|
||||||
|
Loading…
Reference in New Issue
Block a user