cafejojo / schaapi

🐑 Safe Changes for APIs

Home Page:https://cafejojo.org/schaapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`TestGenerator`: `OutputStream` vs `File`

FWDekker opened this issue · comments

The TestGenerator currently outputs an OutputStream. Initially, the idea was to make the implementation independent of the file system. However, I see no convincing reason to do this. I suggest that the interface is changed to return a File instead.

In practice, I agree. There are scenarios where an output stream could be more desirable / cleaner (passing it to a next stage, such as a database, without writing to file). But as our current test generation setup writes it to file, anyway, I don't think that it is relevant for now

@gandreadis I don't understand your comment. Yes, our current setup writes it to a file, but that's exactly why this issue is relevant: By currently returning an OutputStream rather than a File we're only making it more difficult for ourselves.

Exactly. But by saying that the interface only outputs files, we are forcing implementations to write to a file (which is not always desirable). In any case, I think you misread my comment: in our current situation, I agree with you that we should change it to File

I indeed misread your comment. Let's change it to File sometime in the future (tomorrow?).

Additionally, if we do, we should also consider changing the Project to use streams: If the output should not be restricted to files, why should the input?