package novoda.lib.sqliteprovider.util;

import static org.junit.Assert.*;

import android.net.Uri;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(RoboRunner.class)
public class UriToSqlAttributesInspectorTest {

    private UriInspector uriInspector = new UriInspector();;
    private UriToSqlAttributes attrs = null;

    @Before
    public void setup() {
        uriInspector = new UriInspector();
    }

    @Test
    public void testUriInspectorCreationBehaviour() {
        attrs = uriInspector.parse(Uri.parse("content://test.com/item/1"));
        assertEquals("content://test.com/item/1", attrs.getUri().toString());
    }

    @Test
    public void testHasWhereClauseInQuery() {
        attrs = uriInspector.parse(Uri.parse("content://test.com/item/1"));
        assertFalse(attrs.hasWhereClauseInQuery());
        attrs = uriInspector.parse(Uri.parse("content://test.com/tableName?groupBy=col&having=value"));
        assertTrue(attrs.hasWhereClauseInQuery());
    }
}
@@ -38,43 +38,8 @@
 l;%0A%0A
-import static org.junit.Assert.*;%0A%0A
 impo
@@ -107,23 +107,31 @@
 t.Test;%0A
+%0A
 import 
+static 
 org.juni
@@ -136,51 +136,98 @@
 nit.
-runner.RunWith;%0A%0A@RunWith(RoboRunner.class)
+Assert.*;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A
 %0Apub
@@ -312,31 +312,10 @@
 ctor
- = new UriInspector();
 ;
+%0A
 %0A   
@@ -351,15 +351,29 @@
 ttrs
- = null
+;%0A    private Uri uri
 ;%0A%0A 
@@ -452,16 +452,47 @@
 ctor();%0A
+        uri = mock(Uri.class);%0A
     %7D%0A%0A 
@@ -593,49 +593,15 @@
 rse(
-Uri.parse(%22content://test.com/item/1%22)
+uri
 );%0A
+%0A
     
@@ -621,35 +621,11 @@
 als(
-%22content://test.com/item/1%22
+uri
 , at
@@ -640,19 +640,8 @@
 ri()
-.toString()
 );%0A 
@@ -676,16 +676,20 @@
 oid test
+When
 HasWhere
@@ -705,89 +705,202 @@
 uery
-() %7B%0A        attrs = uriInspector.parse(Uri.parse(%22content://test.com/item/1%22)
+ThenResultTrue() %7B%0A        Uri uri = mock(Uri.class);%0A        when(uri.toString()).thenReturn(%22content://test.com/tableName?groupBy=col&having=value%22);%0A        attrs = uriInspector.parse(uri
 );%0A
+%0A
     
@@ -913,12 +913,11 @@
 sert
-Fals
+Tru
 e(at
@@ -954,108 +954,241 @@
     
+%7D%0A%0A
     
-attrs = uriInspector.parse(Uri.parse(%22content://test.com/tableName?groupBy=col&having=value%22)
+@Test%0A    public void testWhenDoesNotHaveWhereClauseInQueryThenResultFalse() %7B%0A        Uri uri = mock(Uri.class);%0A        when(uri.toString()).thenReturn(%22content://test.com/item/1%22);%0A        attrs = uriInspector.parse(uri
 );%0A
+%0A
     
@@ -1189,35 +1189,36 @@
 %0A%0A        assert
-Tru
+Fals
 e(attrs.hasWhere
@@ -1242,8 +1242,9 @@
 %0A    %7D%0A%7D
+%0A

Remove robolectric dependence