Code example for Spinner

Methods: setAdapter, getSelectedItem, setSelection

0
		spinner.getSelectedItem();		
	} 
	 
	@Test 
	public void setSelectionWithAnimatedTransition() {		 
		spinner.setAdapter(arrayAdapter);
		spinner.setSelection(0, true);
 
        assertThat((String) spinner.getSelectedItem()).isEqualTo("foo");
        assertThat((String) spinner.getSelectedItem()).isNotEqualTo("bar");
 
        assertThat(shadowSpinner.isAnimatedTransition()).isTrue();
	} 
 
    private static class MyArrayAdapter extends ArrayAdapter<String> {
        public MyArrayAdapter(Context context, String[] testItems) {
            super(context, android.R.layout.simple_spinner_item, testItems);
        } 
 
        @Override public View getView(int position, View convertView, ViewGroup parent) {
            return new View(getContext());