2 ms·
> "new" keyword is basically introducing side effects, everywhere, >> I don't think that's what it does. From a java testing perspective, it does. There is no
by Supermancho 4y ago
> "new" keyword is basically introducing side effects, everywhere,
>> I don't think that's what it does.
From a java testing perspective, it does. There is no way to mock something that is new'd. This is a failure of the language. ie Python, p1 = MyClass()
Now you have something mockable.
> the Lombok and Jackson ones are pretty decent.
They are, but they aren't in the language because Oracle (and the existing language development practices). Actual improvements are haphazardly added to java because 3rd parties already did the work, so why should they make the language better? Just use the increasingly obscure set of 3rd party additions.