• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package libcore.java.io;
18 
19 import java.io.Serializable;
20 import junit.framework.TestCase;
21 import libcore.java.util.SerializableTester;
22 
23 public final class SerializationTest extends TestCase {
24 
25     // http://b/4471249
testSerializeFieldMadeTransient()26     public void testSerializeFieldMadeTransient() throws Exception {
27         // this was created by serializing a FieldMadeTransient with a non-0 transientInt
28         String s = "aced0005737200346c6962636f72652e6a6176612e696f2e53657269616c697a6174696f6e54657"
29                 + "374244669656c644d6164655472616e7369656e74000000000000000002000149000c7472616e736"
30                 + "9656e74496e747870abababab";
31         FieldMadeTransient deserialized = (FieldMadeTransient) SerializableTester.deserializeHex(s);
32         assertEquals(0, deserialized.transientInt);
33     }
34 
35     static class FieldMadeTransient implements Serializable {
36         private static final long serialVersionUID = 0L;
37         private transient int transientInt;
38     }
39 }
40