Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 333993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:00:47+00:00 2026-05-12T10:00:47+00:00

I am trying to test my DB using ProviderTestCase2<T> . I can see the

  • 0

I am trying to test my DB using ProviderTestCase2<T>. I can see the test DB being created. As such I suppose, the tested content provider should use the test DB. But as soon as I try any calls against the MockContentResolver (or the one created with newResolverWithContentProviderFromSql), I get an UnsupportedOperationException. This is documented for the MockContentResolver as normal behavior. As such I am a bit unsure on the purpose of the ProviderTestCase2.

How do you test your content providers?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:00:47+00:00Added an answer on May 12, 2026 at 10:00 am

    Extend ProviderTestCase2 to override getMockContentResolver() and return your own class derived from MockContentResolver.

    public class MyProviderTestCase2 extends ProviderTestCase2 {
        @Override
        public MockContentResolver getMockContentResolver () {
            return new MyMockContentResolver();
        }
    }
    

    MyMockContentResolver will need to override any methods you want to test in your ContentProvider.

    Then you should be able to run any tests you want on your content provider while it’s isolated by ProviderTestCase2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to test a webpage using Nessus. I have tested all the
Trying to test to see if a user is logged in I am using
I've created an asp.net web service and am trying to test it using my
I'm trying to test using QTP a web app that is using ajax4jsf to
I'm trying to unit test my routes using the MvcContrib.TestHelper ShouldMapTo <TController> () extension
Im trying to test my successfully creates a new user after login (using authlogic).
I am trying to test a stress test a web service using JMeter but
I'm trying to retrofit some tests using Test::More to legacy code and I've bumped
I'm trying to test a single file if it is open using lsof. Is
Using LINQPad, I am trying to test a few snippets with my own C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.