assert vs. JUnit Assertions

前端 未结 6 965
难免孤独
难免孤独 2020-11-29 03:32

Today I saw a JUnit test case with a java assertion instead of the JUnit assertions—Are there significant advantages or disadvantages to prefer one over the other?

6条回答
  •  温柔的废话
    2020-11-29 03:54

    I'd say use JUnit asserts in test cases, and use java's assert in the code. In other words, real code shall never have JUnit dependencies, as obvious, and if it's a test, it should use the JUnit variations of it, never the assert.

提交回复
热议问题