assert vs. JUnit Assertions

前端 未结 6 963
难免孤独
难免孤独 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 prefer JUnit assertions as they offer a richer API than the built-in assert statement and, more importantly do not need to be explicitly enabled unlike assert, which requires the -ea JVM argument.

提交回复
热议问题