Nine Reasons I LOVE writing tests and Test-driven Development
· 3 min read
Streaming is an awesome tool. It helps to separate concerns (e.g., iteration, filtering, execution), to avoid state and thus improves thread safety. Additionally, we can express the same functionality with less code. But it’s hard to read and to test.
Really?
I bet you’ve seen code like this when your IDE auto-completed a function call in your code and there’s no source code or Javadoc found:
emailSender.sendEmail(String arg1,
InternetAddress arg2, InternetAddress arg3, InternetAddress arg4,
String arg5, String arg6, List<EmailAttachment> arg7);
PMD will annotate this code as a violation of the rule "Getting Rid of Nasty Parameters."