Need explanation on the necessity of a prior flushing to avoid false positives whenTesting with Spring ?

后端 未结 4 1090
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 08:43

In the spring documentation regarding testing, it states:

Avoid false positives when testing ORM code

When you test code involving an

4条回答
  •  既然无缘
    2021-01-02 08:58

    Spring documentation uses the wrong concept. It has been clear

    but the same code throws an exception in a live, production environment

    Here goes wikipedia

    Type II error, also known as an "error of the second kind", a β error, or a "false negative": the error of failing to reject a null hypothesis when it is in fact not true. An example of this would be if a test shows that a woman is not pregnant, when in reality, she is.

    If you see the sample provided by Spring, The production environment throws an exception (A GenericJDBCException), but it has not been detected. In order to see, you must call the underlying commit when using some ORM provider.

    XUnit Test patterns definition

    A situantion in which a test passes even though the system under test is not working properly.

    So the right concept is falseNegative

    @Test // no expected exception!
    public void falseNegative() {
    

提交回复
热议问题