package com.xtremelabs.robolectric.shadows;

import android.app.Activity;
import android.widget.AdapterView;
import android.widget.Gallery;
import android.widget.Spinner;
import android.widget.ArrayAdapter;
import android.content.Context;
import android.test.mock.MockContext;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.WithTestDefaultsRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(WithTestDefaultsRunner.class)
public class AbsSpinnerTest {
    private AdapterView adapterView;
	private Spinner spinner;
	private ArrayAdapter<String> arrayAdapter;
	private Context context;

    @Before
    public void setUp() throws Exception {
        Robolectric.bindDefaultShadowClasses();
		context = new MockContext();
        adapterView = new Gallery(new Activity());
		spinner = new Spinner(context);
		String [] testItems = {"foo", "bar"};
		arrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, testItems);
    }

    @Test
    public void shouldHaveAdapterViewCommonBehavior() throws Exception {
        AdapterViewBehavior.shouldActAsAdapterView(adapterView);
    }

	@Test
	public void checkSetAdapter()
	{
		spinner.setAdapter(arrayAdapter);
	}
}

@@ -86,22 +86,45 @@
 oid.
-widget.Adapter
+content.Context;%0Aimport android.view.
 View
@@ -144,22 +144,22 @@
 oid.
-widget.Gallery
+view.ViewGroup
 ;%0Aim
@@ -178,23 +178,27 @@
 .widget.
-Spinner
+AdapterView
 ;%0Aimport
@@ -238,39 +238,38 @@
 ort android.
-content.Context
+widget.Gallery
 ;%0Aimport and
@@ -277,29 +277,22 @@
 oid.
-test.mock.MockContext
+widget.Spinner
 ;%0Aim
@@ -655,34 +655,8 @@
 ter;
-%0A%09private Context context;
 %0A%0A  
@@ -756,18 +756,32 @@
 sses();%0A
-%09%09
+        Context 
 context 
@@ -790,19 +790,16 @@
 new 
-MockContext
+Activity
 ();%0A
@@ -944,16 +944,18 @@
 r = new 
+My
 ArrayAda
@@ -962,62 +962,16 @@
 pter
-%3CString%3E(context, android.R.layout.simple_spinner_item
+(context
 , te
@@ -1179,18 +1179,17 @@
 dapter()
-%0A%09
+ 
 %7B%0A%09%09spin
@@ -1220,11 +1220,389 @@
 ter);%0A%09%7D
+%0A%0A    private static class MyArrayAdapter extends ArrayAdapter%3CString%3E %7B%0A        public MyArrayAdapter(Context context, String%5B%5D testItems) %7B%0A            super(context, android.R.layout.simple_spinner_item, testItems);%0A        %7D%0A%0A        @Override public View getView(int position, View convertView, ViewGroup parent) %7B%0A            return new View(getContext());%0A        %7D%0A    %7D
 %0A%7D%0A

Fix broken test.