Flutter Engine
The Flutter Engine
ExampleInstrumentedTest.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package dev.flutter.scenarios;
6
7import static org.junit.Assert.*;
8
9import android.content.Context;
10import androidx.test.ext.junit.runners.AndroidJUnit4;
11import androidx.test.platform.app.InstrumentationRegistry;
12import org.junit.Test;
13import org.junit.runner.RunWith;
14
15/**
16 * Instrumented test, which will execute on an Android device.
17 *
18 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
19 */
20@RunWith(AndroidJUnit4.class)
22 @Test
23 public void useAppContext() {
24 // Context of the app under test.
25 Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
26
27 assertEquals("dev.flutter.scenarios", appContext.getPackageName());
28 }
29}