RFR: 1627: Add tests for bot factories

Erik Joelsson erikj at openjdk.org
Tue Oct 11 16:21:12 UTC 2022


On Mon, 10 Oct 2022 18:08:09 GMT, Zhao Song <zsong at openjdk.org> wrote:

> Hi @erikj79 ,this commit contains test for CSRBotFactory. If you think this is ok, I would add tests for other bot factories as well.

I started to look around the source and I found TestBotFactory which seems to already be doing most of what I was envisioning here. Only two existing bots are using it for their tests, which is why I've missed it before. With that class you can supply just the JSON for the bot factory under test, and any other entities (i.e. IssueTracker or forge) are added as already constructed objects (using the test implementations).

Unless it's really needed, I would advice having the JSON defined inline in the test using the new triple quote multiline string literals (https://blogs.oracle.com/javamagazine/post/text-blocks-come-to-java). The size of these snippets should be fairly small as they only need to contain test configuration for a single bot.

-------------

PR: https://git.openjdk.org/skara/pull/1393


More information about the skara-dev mailing list