### Question:
TodoController { public void addItem(final String text) { if(TextUtils.isEmpty(text)) { return; } realm.executeTransactionAsync(new Realm.Transaction() { public void execute(Realm bgRealm) { bgRealm.insertOrUpdate(new TodoItem(text)); } }); } TodoController();  TodoController(Realm realm); void close(); void addItem(final String text); void deleteAllChecked(); void setAllCheckedValue(final boolean isChecked); void setSingleCheckedValue(final String itemId, final boolean isChecked);  }### Answer:
@Test public void testAddItem() throws Exception { final String todoItemText = "Walk the dog"; final ArgumentCaptor<TodoItem> itemCaptor = ArgumentCaptor.forClass(TodoItem.class); final ArgumentCaptor<Realm.Transaction> txCaptor = ArgumentCaptor.forClass(Realm.Transaction.class); controller.addItem(todoItemText); verify(mockRealm, times(1)).executeTransactionAsync(txCaptor.capture()); txCaptor.getValue().execute(mockRealm); verify(mockRealm, times(1)).insertOrUpdate(itemCaptor.capture()); assertEquals(todoItemText, itemCaptor.getValue().getText()); }