Various tests fixes

* Use a tmp file in the `FileTests.testFileReadingFlow()`
for writing content and then rename it to the target file.
It looks like we may already have a file just with a short content
and it is picked up by the watch service for processing in the flow
* Rework `AggregatorWithCustomReleaseStrategyTests` to JUnit 5 and remove
extra looping logic since it just does not add any extra coverage just
performance overhead via crating and destroying the same application ctx
* Rework `ChannelAdapterParserTests` to `@SpringJUnitConfig` managed test
This commit is contained in:
Artem Bilan
2021-02-25 11:29:28 -05:00
parent 51b6ba8de8
commit c023816c7e
5 changed files with 111 additions and 164 deletions

View File

@@ -201,10 +201,12 @@ public class FileTests {
if (even) {
evens.add(i);
}
FileOutputStream file = new FileOutputStream(new File(tmpDir, i + extension));
file.write(("" + i).getBytes());
file.flush();
file.close();
File tmpFile = new File(tmpDir, i + extension + ".tmp");
FileOutputStream stream = new FileOutputStream(tmpFile);
stream.write(("" + i).getBytes());
stream.flush();
stream.close();
tmpFile.renameTo(new File(tmpDir, i + extension));
}
Message<?> message = fileReadingResultChannel.receive(60000);