|
From: Sean S. <su...@us...> - 2006-03-25 22:08:04
|
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; + } + } } |