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