* @param remote
* @throws Throwable
*/
private void testPassByValueForMethodParameters(MyRemote remote) throws Throwable
{
SimplePojo localSimplePojo = new SimplePojo();
// set some initial value
int value = 3;
localSimplePojo.setTransientField(value);
// call the method on the bean
SimplePojo returnedPojo = remote.changeAndReturn(localSimplePojo);
// The passed and the returned objects should not be the same
assertFalse(
"The object passed to the method of the remote bean and the object returned from the bean are both the same",
localSimplePojo == returnedPojo);
// Any value changed in the method of the remote bean should not
// affect the local object - Confirms pass by value
assertEquals("The object passed to a method of remote bean was modified(passed by reference)", localSimplePojo
.getTransientField(), value);
SimplePojo anotherPojo = new SimplePojo();
SimplePojo returnedObj = remote.doNothingAndReturn(anotherPojo);
// The passed and the returned objects should not be the same
assertFalse(
"The object passed to the method of the remote bean and the object returned from the bean are both the same",
anotherPojo == returnedObj);