Open xenthm opened 1 day ago
Possible to read/load from one file but write the save file to another destination to prevent the overwriting? Just an idea.
Possible to read/load from one file but write the save file to another destination to prevent the overwriting? Just an idea.
Do you mean just for tests? Because if we do this for the main app we need to get the user to indicate where they last saved their data.
- Set up dataFile in Storage to be a different path before running any JUnit test for commands that modify the authorList
Actually, option 1 is already implemented, but only in StorageTest
.
So all we need to do it extend it so that all tests do this.
yup just for tests only, basically like the IO test where we have actual and expected as two separate files.
Alright, I did that for StorageTest
. For future development it is probably worth it to set a global JUnit setting so that all tests use a different data file. However, it needs to be deconflicted with testCatalog.json
which is needed by StorageTest
. It shouldn't be changed.
Updated severity as this only affects developers that use gradlew build
.
Issue
When
gradlew build
is run to build the project with Gradle, JUnit tests are run. The JUnit tests for commands that modify theauthorList
(and hence will save the changes to the data file) are using the local copy ofcatalog.json
to perform tests. This overrides the contents of the file.Potential fixes
dataFile
inStorage
to be a different path before running any JUnit test for commands that modify theauthorList
Storage
to instantiate it differently for JUnit testsContents of
catalog.json
aftergradlew build
is runThe
authorList
serialized here is from a JUnit test.