harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
Date Fri, 16 Mar 2007 07:18:09 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-3400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Richard Liang reassigned HARMONY-3400:
--------------------------------------

    Assignee: Richard Liang

> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>         Assigned To: Richard Liang
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException
{
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message