luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

#195 - Throw exception if same section is added to the adapter #196

Closed luizgrp closed 4 years ago

yccheok commented 4 years ago

Looks good to me. It prevents 2 things

1) Prevent caller from adding same instance twice.

2) Prevent caller from adding 2 instance of Section, which their hashCode and equals methods have been overridden in some way. (Not sure you would like to provide unit test to test this as well?)

codecov-io commented 4 years ago

Codecov Report

Merging #196 into develop will decrease coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #196      +/-   ##
===========================================
- Coverage    92.04%   92.00%   -0.04%     
===========================================
  Files            7        7              
  Lines          616      638      +22     
  Branches        79       85       +6     
===========================================
+ Hits           567      587      +20     
- Misses          26       28       +2     
  Partials        23       23              
Impacted Files Coverage Δ
...p/sectionedrecyclerviewadapter/SectionAdapter.java 99.20% <ø> (ø)
...yclerviewadapter/SectionedRecyclerViewAdapter.java 87.87% <100.00%> (+0.27%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 15e883d...9c21beb. Read the comment docs.

luizgrp commented 4 years ago

@yccheok added unit test for scenario 2 👍

yccheok commented 4 years ago

Thank you so much! 😘