Currently when reading/writing JSON and using the reader/marshaller provided
and you want a custom Gson or ObjectMapper instance it still creates the not
needed instance. Move the construction to a constructor and provide a constructor
to directly pass in the pre-configured Gson or ObjectMapper instance.
The same approach is used in Spring itself where Gson or ObjectMapper instances
can be passed in.
This commit temporarily ignores tests that are failing
intermittently on Windows. A link to the corresponding
issue has been added to each test.
FTR, I tried to ignore those tests only on Windows by
using `Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);`
where `SystemUtils` is from `org.apache.commons.lang3`
but this assumption does not seem to work as expected.
The test `testCompareNewWithOldAfterCopy` does
not work on linux/unix unless a `Thread.sleep`
is added before the file copying (see cbcf28c3).
This test does not work on windows neither,
because it is based on apache commons
`FileUtils.copyFile` which does not honor
`preserveFileDate=false` on windows.
The following test works on linux/unix
but not on windows:
```
@Test
public void testLastModifiedAfterCopy() throws IOException {
File existing = new FileSystemResource(FILE_PATH).getFile();
File temp = new File("target/temp.txt");
assertFalse(temp.exists());
FileUtils.copyFile(existing, temp, false);
assertTrue(temp.lastModified() > existing.lastModified());
}
```
On windows, even though `preserveFileDate=false`,
the last modification date of the copy is equal
(ie preserved) to the one of the original file,
which is not the case on linux/unix. Trying to
use an alternative like `java.nio.file.Files#copy`
does not work since it only offers the ability
to either copy file attributes or replace the
existing file (which is not the idea of this test).
This test does not add any value and should have
been removed since a long time (see TODO in 12d6613).
Before this commit, tests in this change set
were failing on MS Windows due to the file
comparison method which was based on file
content hash comparison. With this method,
differences between OS line endings
(LF vs CRLF) in generated json files produce
different hashes.
This commit uses a logical json comparison
based on the jsonassert library.
This test fails on Java 15 because the Javascript engine
has been removed in Java 15 (JEP 372).
This commit updates the test to assume that the JavaScript
engine is provided to the JVM through a factory (similar
to other tests).
This commit updates the configuration to run unit tests
with maven-surefire-plugin and integration tests with
maven-failsafe-plugin. JSR-352 TCK tests are considered
as integration tests and are executed with other integration
tests (no need for a separate profile to run them).
Some unit tests were failing when integration tests were
skipped.. Those tests have been temporarily ignored.