https://kotlinlang.org logo
#announcements
Title
# announcements
m

mg6maciej

04/21/2017, 10:30 PM
Package-private and testing shouldn't have anything to do with each other tho. Test what's public.
3
b

benleggiero

04/22/2017, 1:49 AM
I have to disagree. I think everything that's testable should be tested. Even private and internal things should work the way you expect them to, and tests prevent that from changing
m

mg6maciej

04/22/2017, 2:12 AM
As always there is no absolute truth. You may code the way it works for you and I may do the same, but differently. Let me know when, while doing refactoring, you find yourself in a spot where you have to update or remove a bunch of tests because they interacted directly with something that was (package-)private. In the meantime, a short video for your pleasure: https://vimeo.com/120572733
Suggest listening at 26:40.
@benleggiero I just though maybe we are on the same page... I completely agree with "Even private and internal things should work the way you expect them to, and tests prevent that from changing", but such behavior should be tested via public interface, I.e. tests check what code does and are not cementing the implementation. You could, without fear, extract stuff into a separate package-private (or private and in the same file) class and not have tests break.
👍 2
b

benleggiero

04/23/2017, 3:14 PM
I think we are, too! Perhaps it's because I think very modularly, where my code is split into several modules, all of which have a sort of "public" API, even if they're never used outside the particular app.