Code example for Gallery

0
	private ArrayAdapter<String> arrayAdapter;
 
    @Before 
    public void setUp() throws Exception { 
        context = new Activity();
        adapterView = new Gallery(context);
		spinner = new Spinner(context);
		shadowSpinner = (ShadowAbsSpinner) Robolectric.shadowOf(spinner);
		String [] testItems = {"foo", "bar"};
		arrayAdapter = new MyArrayAdapter(this.context, testItems);
    } 
 
    @Test 
    public void shouldHaveAdapterViewCommonBehavior() throws Exception { 
        AdapterViewBehavior.shouldActAsAdapterView(adapterView);
    } 
 
	@Test 
	public void checkSetAdapter() { 
		spinner.setAdapter(arrayAdapter);
	}