最近没事,看看了看android源代码,发现有一个地方不理解,请高人解释下,TestCase 是一个接口,为什么AndroidTestCase 类用extends 而不是用 implements 呢?/**
* 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();
}@Deprecated
public 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();
}
* 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();
}@Deprecated
public 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();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货