最近没事,看看了看android源代码,发现有一个地方不理解,请高人解释下,TestCase 是一个接口,为什么AndroidTestCase 类用extends 而不是用 implements 呢?
- Java code
/** * Extend this if you need to access Resources or other things that depend on Activity Context. */public class AndroidTestCase extends TestCase { protected Context mContext; private Context mTestContext; @Override protected void setUp() throws Exception { super.setUp(); }
- Java code
@Deprecatedpublic interface TestCase extends Runnable{ /** * Called before run() is called. */ public void setUp(Context context); /** * Called after run() is called, even if run() threw an exception, but * not if setUp() threw an execption. */ public void tearDown();}
------解决方案--------------------
你看到的TestCase的定义是在哪里?我这里看到的是abstract class
[email protected]
不然,Java编译都会不过