Mockito mock setter() and override getter()
<p>I am not doing a unitTesting on Android Application.
<br><br>
<strong>TextChoiceAdapter.java:</strong></p>

<pre><code>public class TextChoiceAdapter extends ArrayAdapter&lt;String&gt; {
    public Context context;
    public int selectedPosition = -1;   //Otherwise Android set zero then choice A will be selected automatically
    public void choiceSelection(View rowView, int position){
        if (selectedPosition == position)
            rowView.setBackgroundColor(0xA0FF8000); // orange
        else
            rowView.setBackgroundColor(Color.TRANSPARENT);
    }
    public TextChoiceAdapter(Context context,int resources, List&lt;String&gt; textChoiceList) {
        super(context, resources, textChoiceList);
        this.context = context;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
      ...
    }
}
</code></pre>

<p><strong>TextChoiceAdapterTest.java:</strong></p>

<pre><code>public class TextChoiceAdapterTest{
    private TextChoiceAdapter textChoiceAdapter;
    private ArrayList&lt;String&gt; textChoiceList;
    @Before
    public void setUp(){
        textChoiceList = new ArrayList&lt;&gt;();
        textChoiceList.add("North");
        textChoiceList.add("East");
        textChoiceList.add("West");
        textChoiceList.add("South");
        Context context = mock(Context.class);
        textChoiceAdapter = new TextChoiceAdapter(context, 1, textChoiceList);
    }
    @Test
        public void testChoiceSelection(){
    //https://stackoverflow.com/questions/10217793/mockito-how-to-stub-getter-setter

    textChoiceAdapter.selectedPosition = 1;
    Context context = mock(Context.class);

    //Try my own object class.
    class mockRowView extends View{
        int backgroundColor;
        public mockRowView(Context context){
            super(context);
        }
        public void setBAckgroundColor(int a){
            this.backgroundColor = a;
        }
        public int getBackgroundColor(){
            return this.backgroundColor;
        }
    }
    View rowView = mock(mockRowView.class);
    textChoiceAdapter.choiceSelection(rowView, 1);
    assertEquals(rowView.getBackgroundColor(), 0xA0FF8000);
}
}
</code></pre>

<p><strong>Error:</strong><br>
<code>java.lang.AssertionError: 
Expected :null
Actual   :-1593868288</code></p>

<p><strong>My question:</strong><br>
How to <code>mock</code> my <code>rowView</code> with <code>setter()</code> and <code>getter()</code> properly?<br>
I want different answer from different input.</p>

<p>I am imitating <a href="https://stackoverflow.com/questions/10217793/mockito-how-to-stub-getter-setter">Mockito: how to stub getter setter</a></p>