tests failing in core on Windows

So,

I can only make the tests pass on Windows if I close the FileInputStream we put into the obs ComplexData.data

changes and see passing tests on Windows GitHub check on Windows

That is obviously not a fix because it means that after doing handler.getObs(obs1, "RAW_VIEW").getComplexData().getData() the FileInputStream is already closed an cannot be read.

Can someone explain to me why closing the streams in the test at https://github.com/openmrs/openmrs-core/pull/3380/commits/a4c7c897cba198146cdf2af0c0182d60ab061351#diff-1dfc7fecf17fefaff8bfde15c13b002bR113-R114 does not actually make the test pass? I did try to close it before and then on these lines I got, Stream is closed Exception.

Is it something super obvious that I am not seeing because I am tired :sweat_smile: I am unsure about this API. The data is of type Object how does anyone know that it is a stream or when it is a stream? What type of stream? And that its already open? And that one should make sure to close it.

What are our options? Any ideas. I am not sure what to do with these tests or the behaviour. I do think the JUnit 5 implementation of @TempDir seems more strict, which is good as it can uncover such things.