SortedList { public int size() { return mSize; } SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback);  SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback, int initialCapacity); int size(); int add(T item); void addAll(@NonNull T[] items, boolean mayModifyInput); void addAll(@NonNull T... items); void addAll(@NonNull Collection<T> items); void replaceAll(@NonNull T[] items, boolean mayModifyInput); void replaceAll(@NonNull T... items); void replaceAll(@NonNull Collection<T> items); void beginBatchedUpdates(); void endBatchedUpdates(); boolean remove(T item); T removeItemAt(int index); void updateItemAt(int index, T item); void recalculatePositionOfItemAt(int index); T get(int index); int indexOf(T item); void clear(); static final int INVALID_POSITION; }
@Test public void testEmpty() { assertEquals("empty", mList.size(), 0); }
@Test public void testAddDuplicate() { Item item = new Item(1); Item item2 = new Item(item.id); insert(item); assertEquals(0, insert(item2)); assertEquals(1, size()); assertEquals(1, mAdditions.size()); assertEquals(0, mUpdates.size()); }