Skip to content

Commit

Permalink
Added robolectric test for TreasureListAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
cfraz89 committed Mar 5, 2014
1 parent db5dbfc commit 4fa78d5
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.thoughtworks.androidbootcamp.controller.adapter;

import android.app.Activity;
import android.content.Context;

import com.thoughtworks.androidbootcamp.controller.HelloAndroid;

import org.junit.Assert;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

@RunWith(RobolectricTestRunner.class)
public class TreasureListAdapterTest {

@Config(emulateSdk = 18)
@Test
public void shouldReturnItemCountAsNumberOfImagesProvided() throws Exception {
int numTreasures = 10;
TreasureListAdapter adapter = new TreasureListAdapter(Mockito.mock(Context.class), new String[numTreasures]);
Assert.assertEquals(10, adapter.getCount());
}
}

0 comments on commit 4fa78d5

Please sign in to comment.