News for hackers. Stuff that matters.
Re:Java 8 vs. Java 9 by creepydata on Friday June 09, 2017 @09:32AM (#14521205)
Um, you really should be loading that sort of text/data from an external resource rather than embedding it in source code. Those sort of text blocks really don't belong in source code.
Re:Java 8 vs. Java 9 by jitl on Friday June 09, 2017 @11:55AM (#14522243)
Why not? Why should a developer need to go through hoops like saving a string to a file then performing IO to load the string into a test case? What's the advantage of moving a string literal into a non-source file?

If I'm trying to test how my system will parse a specific JSON case into a domain object, isn't it easier to read if my test case is completely expressed on the screen?

Re:Java 8 vs. Java 9 by piva00 on Friday June 09, 2017 @12:44PM (#14522567)
The I/O will happen anyway, either at the start of the test when loading the compiled test program WITH the big chunk of a string or when reading it from disk, of course you'll add a bit of latency for opening the file itself but it's a very small price to be paid for maintainability.

Even when I develop in Python with multiline strings I use fixture files to better organise my code.

Edit: removed an "even" before maintainability that was part of a first draft.

Re:Java 8 vs. Java 9 by xpaqui on Friday June 09, 2017 @04:27PM (#14524263)
This is just nonsense not everything will go into a file. Somethings are easier to read on the test itself. It's a case by case problem and choosing is a great asset.