Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import static org.hamcrest.CoreMatchers.is;
      4 import static org.hamcrest.CoreMatchers.notNullValue;
      5 import static org.junit.Assert.assertThat;
      6 
      7 import org.junit.Before;
      8 import org.junit.Test;
      9 import org.junit.runner.RunWith;
     10 
     11 import android.content.ContentProvider;
     12 import android.content.ContentValues;
     13 import android.database.Cursor;
     14 import android.net.Uri;
     15 
     16 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
     17 
     18 @RunWith(WithTestDefaultsRunner.class)
     19 public class ContentProviderTest {
     20 
     21 	class TestContentProvider extends ContentProvider {
     22 
     23 		@Override
     24 		public int delete(Uri arg0, String arg1, String[] arg2) {
     25 			return 0;
     26 		}
     27 
     28 		@Override
     29 		public String getType(Uri arg0) {
     30 			return null;
     31 		}
     32 
     33 		@Override
     34 		public Uri insert(Uri arg0, ContentValues arg1) {
     35 			return null;
     36 		}
     37 
     38 		@Override
     39 		public boolean onCreate() {
     40 			return false;
     41 		}
     42 
     43 		@Override
     44 		public Cursor query(Uri arg0, String[] arg1, String arg2,
     45 				String[] arg3, String arg4) {
     46 			return null;
     47 		}
     48 
     49 		@Override
     50 		public int update(Uri arg0, ContentValues arg1, String arg2,
     51 				String[] arg3) {
     52 			return 0;
     53 		}
     54 
     55 	}
     56 
     57 	TestContentProvider provider;
     58 
     59 	@Before public void instantiateProvider() {
     60 		provider = new TestContentProvider();
     61 	}
     62 
     63 	@Test public void hasAContext() {
     64 		assertThat(provider.getContext(), is(notNullValue()));
     65 	}
     66 
     67 	@Test public void canGetAResolver() {
     68 		assertThat(provider.getContext().getContentResolver(), is(notNullValue()));
     69 	}
     70 
     71 }
     72