Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2008 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 package android.os.cts;
     17 
     18 import junit.framework.TestCase;
     19 import android.os.BadParcelableException;
     20 
     21 public class BadParcelableExceptionTest extends TestCase {
     22     public void testBadParcelableException(){
     23         BadParcelableException ne = null;
     24         boolean isThrowed = false;
     25 
     26         try {
     27             ne = new BadParcelableException("BadParcelableException");
     28             throw ne;
     29         } catch (BadParcelableException e) {
     30             assertSame(ne, e);
     31             isThrowed = true;
     32         } finally {
     33             if (!isThrowed) {
     34                 fail("should throw out BadParcelableException");
     35             }
     36         }
     37 
     38         isThrowed = false;
     39 
     40         try {
     41             ne = new BadParcelableException(new Exception());
     42             throw ne;
     43         } catch (BadParcelableException e) {
     44             assertSame(ne, e);
     45             isThrowed = true;
     46         } finally {
     47             if (!isThrowed) {
     48                 fail("should throw out BadParcelableException");
     49             }
     50         }
     51     }
     52 
     53 }
     54