Test.java revision 905b33a486631d296670fa1fdf9d41daefb69a36
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * 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, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16package com.android.multidexlegacytestapp; 17 18import android.test.ActivityInstrumentationTestCase2; 19 20/** 21 * Run the tests with: <code>adb shell am instrument -w 22 com.android.multidexlegacytestapp/android.test.InstrumentationTestRunner 23</code> 24 */ 25public class Test extends ActivityInstrumentationTestCase2<MainActivity> { 26 public Test() { 27 super(MainActivity.class); 28 } 29 30 public void testAllClassesAvailable() { 31 assertEquals(3366, getActivity().getValue()); 32 } 33 34 public void testAnnotation() { 35 assertEquals(ReferencedByAnnotation.B, 36 ((AnnotationWithEnum) TestApplication.annotation).value()); 37 assertEquals(ReferencedByAnnotation.B, 38 ((AnnotationWithEnum) TestApplication.getAnnotationWithEnum()).value()); 39 // Just to verify that it doesn't crash 40 getActivity().getAnnotation2Value(); 41 42 assertEquals(ReferencedByClassInAnnotation.class, 43 ((AnnotationWithClass) TestApplication.annotation3).value()); 44 // Just to verify that it doesn't crash 45 ReferencedByClassInAnnotation.A.get(); 46 } 47 48 public void testInterface() { 49 assertEquals(InterfaceWithEnum.class, 50 TestApplication.interfaceClass); 51 } 52} 53