How do I get a bitmap resource with mockito?

Viewed 3856

My class needs a bitmap but mockito's mock context object is not capable of doing that is seems:

    public class PlayerTest {

        @Mock // Mocking the android context class
        Context mMockContext;
        // intantiating object from that mocked class
        Context mContext;

        private Player player;
        private Bitmap playerBitmap;

        private int screenX;
        private int screenY;

        @Before
        public void setupPlayer(){
            playerBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.player);
            player = new Player(mContext, screenX, screenY,playerBitmap);
        }
...
1 Answers
Related