New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Collection setter in RVRendererAdapter #33
Added Collection setter in RVRendererAdapter #33
Conversation
@Test public void shouldBeAdapteeCollectionNotNullWhenCreateOnlyWithRendererBuilder() { | ||
RVRendererAdapter<Object> adapter = new RVRendererAdapter<Object>(mockedRendererBuilder); | ||
|
||
assertNotNull(adapter.getCollection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking that the collection is not null, we should check that the number of items is 0. If the collection inside the RVRendererAdapeter
is null is an implementation detail. We could implement the same behaviour using a null check so my recommendation is to update this test so something like:
@Test public void shouldBeEmptyWhenItsCreatedWithJustARendererBuilder() {
RVRendererAdapter<Object> adapter = new RVRendererAdapter<Object>(mockedRendererBuilder);
assertEquals(0, adapter.getCount());
}
Hi @tonilopezmr thank you so much for your PR :) I've added some comments, please review them and let me know once the PR be ready. |
Thanks you for all comments @pedrovgs Maybe I would send more PR 👍 |
import static org.mockito.Mockito.spy; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
import static org.mockito.Mockito.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know how to avoid that with Optimize imports? 😿
Thank you so much @tonilopezmr. I'm merging this PR and publishing a new version :) If you want to add something to the library remember you can create an issue or send me an email. |
In some occasions when it creates a
AdapteeCollection
forRVRendererAdapter
needs aRecyclerView.Adapter
.package android.support.v7.util.SortedList
:RVRendererAdapter creation:
Renderers
version for this example:RVRendererAdapter creation:
RVRendererAdapter creation: