Home | History | Annotate | Download | only in tests
      1 /*
      2 * Copyright 2013 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 
     18 
     19 /*
     20 * Copyright (C) 2013 The Android Open Source Project
     21 *
     22 * Licensed under the Apache License, Version 2.0 (the "License");
     23 * you may not use this file except in compliance with the License.
     24 * You may obtain a copy of the License at
     25 *
     26 *      http://www.apache.org/licenses/LICENSE-2.0
     27 *
     28 * Unless required by applicable law or agreed to in writing, software
     29 * distributed under the License is distributed on an "AS IS" BASIS,
     30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     31 * See the License for the specific language governing permissions and
     32 * limitations under the License.
     33 */
     34 package com.example.android.displayingbitmaps.tests;
     35 
     36 import com.example.android.displayingbitmaps.*;
     37 
     38 import android.test.ActivityInstrumentationTestCase2;
     39 
     40 /**
     41 * Tests for DisplayingBitmaps sample.
     42 */
     43 public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
     44 
     45     private MainActivity mTestActivity;
     46     private DisplayingBitmapsFragment mTestFragment;
     47 
     48     public SampleTests() {
     49         super(MainActivity.class);
     50     }
     51 
     52     @Override
     53     protected void setUp() throws Exception {
     54         super.setUp();
     55 
     56         // Starts the activity under test using the default Intent with:
     57         // action = {@link Intent#ACTION_MAIN}
     58         // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
     59         // All other fields are null or empty.
     60         mTestActivity = getActivity();
     61         mTestFragment = (DisplayingBitmapsFragment)
     62             mTestActivity.getSupportFragmentManager().getFragments().get(1);
     63     }
     64 
     65     /**
     66     * Test if the test fixture has been set up correctly.
     67     */
     68     public void testPreconditions() {
     69         //Try to add a message to add context to your assertions. These messages will be shown if
     70         //a tests fails and make it easy to understand why a test failed
     71         assertNotNull("mTestActivity is null", mTestActivity);
     72         assertNotNull("mTestFragment is null", mTestFragment);
     73     }
     74 
     75     /**
     76     * Add more tests below.
     77     */
     78 
     79 }