Hi all,
I am trying to use Robolectric to test my class which uses SQLiteDatabase to store Bitmaps. However, I cannot make even the simplest code to work. Here is the stripped down test case which fails:
@Test
public void bitmapDecode() {
Bitmap b = Bitmap.createBitmap(10, 10, Bitmap.Config.RGB_565);
ByteArrayOutputStream stream = new ByteArrayOutputStream(256);
b.compress(CompressFormat.PNG, 100, stream);
byte[] compressedBitmap = stream.toByteArray();
Bitmap immutableBitmap = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length);
assertThat(immutableBitmap, notNullValue());
}
I have
@RunWith(RobolectricTestRunner.
class) and other tests involving Android classes pass (including example from the
Eclipse quick start) so I know Robolectric is configured correctly.
What am I doing wrong?
Thank you,
Alex