Package org.mojavemvc.tests

Examples of org.mojavemvc.tests.TestJSON$SimplePojo


    * @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);
View Full Code Here


    * @param remote
    * @throws Throwable
    */
   private void testPassByValueForReturnedObject(MyRemote remote) throws Throwable
   {
      SimplePojo returnedPojo = remote.getPojo();
      log.info("Returned object has value = " + returnedPojo.getTransientField());
      assertTrue("The object returned from the remote bean is passed by reference",
            returnedPojo.getTransientField() == 0);

   }
View Full Code Here

TOP

Related Classes of org.mojavemvc.tests.TestJSON$SimplePojo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.