Home | History | Annotate | Download | only in tests
      1 /*
      2 * Copyright (C) 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 package com.example.android.revealeffectbasic.tests;
     17 
     18 import com.example.android.revealeffectbasic.*;
     19 
     20 import android.test.ActivityInstrumentationTestCase2;
     21 
     22 /**
     23 * Tests for RevealEffectBasic sample.
     24 */
     25 public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
     26 
     27     private MainActivity mTestActivity;
     28     private RevealEffectBasicFragment mTestFragment;
     29 
     30     public SampleTests() {
     31         super(MainActivity.class);
     32     }
     33 
     34     @Override
     35     protected void setUp() throws Exception {
     36         super.setUp();
     37 
     38         // Starts the activity under test using the default Intent with:
     39         // action = {@link Intent#ACTION_MAIN}
     40         // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
     41         // All other fields are null or empty.
     42         mTestActivity = getActivity();
     43         mTestFragment = (RevealEffectBasicFragment)
     44             mTestActivity.getSupportFragmentManager().getFragments().get(1);
     45     }
     46 
     47     /**
     48     * Test if the test fixture has been set up correctly.
     49     */
     50     public void testPreconditions() {
     51         //Try to add a message to add context to your assertions. These messages will be shown if
     52         //a tests fails and make it easy to understand why a test failed
     53         assertNotNull("mTestActivity is null", mTestActivity);
     54         assertNotNull("mTestFragment is null", mTestFragment);
     55         assertNotNull("Circle view is null", mTestActivity.findViewById(R.id.circle));
     56     }
     57 }
     58