// I have 3 views on my adapter, name, number and photo
  public void testGetView_fills_list_item_view_with_data_and_executes_request()
      throws IOException, InterruptedException {
    // given;
    byte[] data =
        IOUtils.toByteArray(
            getInstrumentation().getContext().getResources().openRawResource(R.raw.binary));
    mockWebServer.enqueue(new MockResponse().setBody(data));
    mockWebServer.play();

    // when
    View view = adapter.getView(0, null, null);
    adapter.await(ADAPTER_UPDATE_TIME_OUT);
    assertTrue(adapter.isLoadBitmapHasBeenCalled());

    // then
    TextView nameView = (TextView) view.findViewById(R.id.user_name_textview);
    ImageView photoView = (ImageView) view.findViewById(R.id.thumbnail_imageview);

    assertNotNull("View is null. ", view);
    assertNotNull("Name TextView is null. ", nameView);
    assertNotNull("Photo ImageView is null. ", photoView);

    assertEquals("Names doesn't match.", data1.getFoo(), nameView.getText());

    // could we get notified of this request ?
    assertEquals(1, mockWebServer.getRequestCount());
    RecordedRequest first = mockWebServer.takeRequest();
    assertEquals("GET /" + data1.getImageUrl() + " HTTP/1.1", first.getRequestLine());

    InputStream cacheInputStream = new FileInputStream(cacheFile);
    assertTrue(
        IOUtils.contentEquals(
            cacheInputStream,
            getInstrumentation().getContext().getResources().openRawResource(R.raw.binary)));
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    cacheFile = new File(getInstrumentation().getTargetContext().getCacheDir(), "Foo");
    cacheFile.delete();
    mockWebServer = new MockWebServer();

    spiceManager = new BitmapSpiceManagerUnderTest();
    spiceManager.start(getInstrumentation().getTargetContext());

    data = new ArrayList<DataUnderTest>();

    data1 = new DataUnderTest();
    data1.setFoo("data1");
    data1.setImageUrl("data1.png");

    data2 = new DataUnderTest();
    data2.setFoo("data2");
    data2.setImageUrl("data2.png");

    data.add(data1);
    data.add(data2);
    adapter =
        new SpiceArrayAdapterUnderTest(getInstrumentation().getTargetContext(), spiceManager, data);
  }
 @Override
 public BitmapRequest createRequest(
     DataUnderTest data, int imageIndex, int reqWidth, int reqHeight) {
   return new BitmapRequest(
       mockWebServer.getUrl("/" + data.getImageUrl()).toString(),
       reqWidth,
       reqHeight,
       cacheFile);
 }
 public void testGetItem_at_position_0() {
   assertEquals("data1 was expected.", data1.getFoo(), adapter.getItem(0).getFoo());
 }
 @Override
 public void update(DataUnderTest data) {
   this.dataUnderTest = data;
   userNameTextView.setText(dataUnderTest.getFoo());
 }