Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在 FEST 库中运行 assertThat() 方法。但是不了解下面在 while 循环中运行的代码的运行时行为。
assertThat(Priority >= nextPriority);
在运行时 Priority = 1 和 nextPriority = 2,但是当我调试此语句该方法时,该方法不会退出,而是继续到 while 循环中的下一行。
有谁知道为什么会这样?
assertThat()不验证任何断言。你想要的是
assertThat()
assertThat(priority >= nextPriority).isTrue();
或更好:
assertThat(priority).isGreaterThanOrEqualTo(nextPriority);