Code example for List

Methods: assertNotEmpty, get, size

0
public class SampleTestTarget3TestCase extends AndroidTestCase {
    public void testGetAllList() throws Exception { 
        SampleTestTarget3 target = new SampleTestTarget3();
        List<SampleDBEntity> list = target.getAllListFromDB(new SampleMockContext(getContext()));
        assertNotNull(list);
        MoreAsserts.assertNotEmpty(list);
        assertEquals(3, list.size());
 
        { 
            SampleDBEntity entity = list.get(0);
            assertEquals(1, entity.getId());
            assertEquals("KeithYokoma", entity.getName());
        } 
 
        { 
            SampleDBEntity entity = list.get(1);
            assertEquals(2, entity.getId());
            assertEquals("HogeFugao", entity.getName());
        } 
 
        { 
            SampleDBEntity entity = list.get(2);
            assertEquals(3, entity.getId());
            assertEquals("HiyoHiyo", entity.getName());
        } 
    }