Closed asolntsev closed 1 year ago
@TimvdLippe I don't really understand why we need to keep longer code if there is a shorter one. Argumentation "everyone is used to" doesn't lead to any progress. People were used to horses, they didn't need cars.
I would rather suggest to add comment like with a longer version:
// mock creation
List mockedList = mock();
// Alternative with specifying exact class to mock:
// List mockedList = mock(ArrayList.class);
@asolntsev Mockito is a long-standing project with a long history of community support and knowledge. There is value in maintaining working patterns for the long-term. The new mock()
usage is nice, but relatively new compared to the rest of Mockito. I do think at some point in the future it makes sense to migrate the ecosystem to mock()
, but today is not that day. That said, I think it is good if we slowly start moving the ecosystem towards it for the brevity argument that you mentioned. I am not convinced that the argument outweighs the historical gained knowledge of the community at this moment in time. We are moving from horses to cars, but not in a day. Let's not change this overnight either.
@TimvdLippe Generally, I totally support the idea of gradual changes. Sure. But this is just a site. It doesn't change anything by itself. It doesn't break anything. It's not a refactoring of existing code base.
People look at the site hoping to see the latest and greatest state of the framework, in order to get knowledge what they could update in their code when they get spare time. I still don't understand why we could not update the site.
this method is available since Mockito 2.10.0
You meant 4.10.0 :).
I agree with Tim that people visiting this site might not yet use 4.10.0, released just 4 days ago and could be confused, report issues, etc. Maybe something like:
// mock creation
List mockedList = mock(List.class);
// or even simpler with Mockito 4.10.0+
// List mockedList = mock();
?
With an option to swap them when the 4.10.0+ usage in Maven Central reaches some sensible level.
this method is available since Mockito 2.10.0