将AssertNotSame转换为AssertThat

问题描述 投票:0回答:1

我希望在自动化测试中拥有更直观的主张。我有一个断言来验证是否显示错误消息,这让您有点头疼。

Assert.assertNotSame((ExpectedConditions.textToBePresentInElementLocated(By.className("notification-title"), "Error message")), "Error message");

关于如何进行转换的任何建议?

junit assert
1个回答
0
投票

最终比我想象的要简单:

assertThat((ExpectedConditions.textToBePresentInElementLocated(By.className("notification-title"), "Error message")), is(not("Error message")));

NotSame and False使我感到困惑:D

© www.soinside.com 2019 - 2024. All rights reserved.