openamf/src/java/org/openamf/util OpenAMFUtilsTest.java,1.6,1.7

Sean Sullivan <[email protected]> Sat, 25 Mar 2006 22:08:00 +0000
Newsgroups gmane.comp.java.openamf.cvs
Message-ID <[email protected]>
Update of /cvsroot/openamf/openamf/src/java/org/openamf/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15374/src/java/org/openamf/util

Modified Files:
	OpenAMFUtilsTest.java 
Log Message:


Index: OpenAMFUtilsTest.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/util/OpenAMFUtilsTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** OpenAMFUtilsTest.java	22 Jun 2004 02:05:58 -0000	1.6
--- OpenAMFUtilsTest.java	25 Mar 2006 22:07:58 -0000	1.7
***************
*** 6,9 ****
--- 6,11 ----
  import java.math.BigDecimal;
  
+ import flashgateway.io.ASObject;
+ 
  /**
   *  
***************
*** 120,124 ****
--- 122,172 ----
    	assertTrue(decodedParam instanceof Long);
    }
+ 
+   public void testDecodeInterface() throws Exception
+   {
+ 	  IFoo f = new FooImpl();
+ 	  
+ 	  Object decodedParam = OpenAMFUtils.decodeParameter(f, IFoo.class);
+ 	  
+ 	  assertTrue(decodedParam instanceof IFoo);
+ 	  
+   }
+ 
+    
+   public void testDecodeInterface2() throws Exception
+   {
+ 	  ASObject aso = new ASObject();
+ 	  aso.put("text", "Super");
+ 	  aso.put("count", "5");
+ 	  
+ 	  Object decodedParam = OpenAMFUtils.decodeParameter(aso, FooImpl.class);
+ 	  
+ 	  assertTrue(decodedParam instanceof IFoo);
+ 	  
+   } 
    
+   public static interface IFoo 
+   {
+ 	  public String getText();
+ 	  public int getCount();
+   }
+ 
+   public static class FooImpl implements IFoo
+   {
+ 	  public FooImpl()
+ 	  {
+ 		  // empty
+ 	  }
+ 	  
+ 	  public String getText()
+ 	  {
+ 		  return "hello";
+ 	  }
+ 	  
+ 	  public int getCount()
+ 	  {
+ 		  return 10;
+ 	  }
+   }
    
  }



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642