Sean Keane wrote:Roel, where did you create the file that was modified when testing your methods that wrote records?
But when I come to Unit testing my methods that write to the data file, i.e. writeRecords, I end up with something quite messy. I need to write to a file and then read back to ensure it worked correctly.
Sean Keane wrote:I don't see what having a separate Eclipse test project would give me - it's same problem, just a different project, no?
Sean Keane wrote:If I am writing to files in my unit tests then I want the files to be in somewhere like the build folder, not in the tests folder. In general, it's not good practice to write to project folders. For example, many source control systems will see these as new files that need to be added to source control.
Sean Keane wrote:I'm not sure what you see difficult about my approach?
Sean Keane wrote:But if you were to start generating files into source controlled folders in a development team, you may have a lot of annoyed developers .
Roel De Nijs wrote:Maybe "difficult" was not the right word here. You just have the added flexibility (and complexity) of being able to give location where each temp file will be created.
Roel De Nijs wrote:As a minor remark: why not use the FileChannels for copying your files?
Let's hope someone from the team is not "to tired" to rollback the checkin of these generated files