Re:Generating a Java program with 90% less code
by pm90 on Wednesday December 04, 2019 @12:00PM
(#21703958)
Unit testing?
[ Parent
| on HN ]
Re:Generating a Java program with 90% less code
by yawgmoth on Wednesday December 04, 2019 @01:04PM
(#21704919)
Not sure about Java, but at least in C# there are clear advantages to using interfaces over concrete classes when using Moq.
Re:Generating a Java program with 90% less code
by GordonS on Wednesday December 04, 2019 @01:41PM
(#21705448)
Interfaces are not the only option - you can also mark methods as virtual.
But overuse of mocking is a very big problem in a lot of codebases. Often I look at a test, and all it seems to do is setup mocks, such that I'm not sure if anything is actually being tested!
My hope is that C#'s new default interface implementations feature will put an end to this mess.