Is there a way to run MySQL in-memory for JUnit test cases?

前端 未结 5 1578
抹茶落季
抹茶落季 2020-12-02 07:01

I\'m just trying to add test cases for services accessing a MySQL DB, and I would like to recreate the whole schema (and for some scenarios also just use a MySQL dump file w

5条回答
  •  一个人的身影
    2020-12-02 07:21

    This is one of the reasons why using proprietary SQL extensions is usually not a good idea.

    What I would do is try to identify the places where you use non-standard SQL and refactor your code to move these parts to dedicated services. Then you can mock these when running unit tests.

提交回复
热议问题