@Test public void testShowMessageString() { int calculated = adapter.getItemCount() + 1; chatActivity.showMessage("Test that ***."); int after = adapter.getItemCount(); assertEquals(calculated, after); }
@Test public void testShowMessageFile() throws IOException { int calculated = adapter.getItemCount() + 1; File file = File.createTempFile("Test that ***.", ".jpeg", context.getFilesDir()); chatActivity.showMessage(file); int after = adapter.getItemCount(); assertEquals(calculated, after); }
@Test public void testShowDataList() throws IOException, NoSuchFieldException, IllegalAccessException { int before = adapter.getItemCount(); chatActivity.showDataList(null); Field field = ChatRecyclerAdapter.class.getDeclaredField("mDataList"); field.setAccessible(true); List<Data> dataList = (List<Data>) field.get(adapter); assertNull(dataList); chatActivity.showDataList(chat.getDataObjects()); dataList = (List<Data>) field.get(adapter); assertTrue(dataList != null); int after = adapter.getItemCount(); assertEquals(before, after); }