Siloportem 1d3f1cc79e Revert "Fixing broken unit test for ConversationAdapter"
Fixes 
Commit 7286fd9 that broke this unit test was reverted so the change to
this unit test has also to be reverted since the unit test currently
fails.

Closes 
This reverts commit 11463d410dca3fc4757b9f476f77f8a72be08f17.
2017-02-26 10:13:15 -08:00

37 lines
1.2 KiB
Java

package org.thoughtcrime.securesms;
import android.database.Cursor;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
public class ConversationAdapterTest extends BaseUnitTest {
private Cursor cursor = mock(Cursor.class);
private ConversationAdapter adapter;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
adapter = new ConversationAdapter(context, cursor);
when(cursor.getColumnIndexOrThrow(anyString())).thenReturn(0);
}
@Test
public void testGetItemIdEquals() throws Exception {
when(cursor.getString(anyInt())).thenReturn("SMS::1::1");
long firstId = adapter.getItemId(cursor);
when(cursor.getString(anyInt())).thenReturn("MMS::1::1");
long secondId = adapter.getItemId(cursor);
assertNotEquals(firstId, secondId);
when(cursor.getString(anyInt())).thenReturn("MMS::2::1");
long thirdId = adapter.getItemId(cursor);
assertNotEquals(secondId, thirdId);
}
}