Android计划如何创建ContentResolver存根?

时间:2013-12-05 19:52:13

标签: java android junit stub

我的项目中有以下课程:

public class SmsManager {
  static final Uri message = Uri.parse("content://sms/");
  ContentResolver resolver;

  public SmsManager(ContentResolver resolver) {
    this.resolver = resolver;
  }

  ...

}

Class将负责对sms消息的操作(如Uri消息所示)。我怎样才能为它编写单元测试?如何轻松存根ContentResolver?

1 个答案:

答案 0 :(得分:1)

查看可能符合您要求的MockContentResolver