gpt4 book ai didi

C# Assert.IsTrue 和 Assert.AreEquals 的 Java 替代代码?

转载 作者:行者123 更新时间:2023-11-30 10:52:13 25 4
gpt4 key购买 nike

在 C# 中:

  Assert.IsTrue(NewPagePost.IsInEditMode(), ""wasn't in edit mode");

Assert.AreEqual("Sample Page", NewPostPage.Title, "Title did not match");

Assert.IsTrue 和 Assert.AreEqual 的 Java 替代品是什么?

下面的代码是否正确:

   Assert.assertTrue("wasn't in edit mode", NewPostPage.IsInEditMode());
Assert.assertEquals("Sample Page,", NewPostPage.getTitle(),"Title did not match");

最佳答案

Assert.assertTrue("wasn't in edit mode", NewPostPage.IsInEditMode());
Assert.assertEquals("Sample Page,", NewPostPage.getTitle(),"Title did not match");

上面看起来不错。

您可以将第二条语句重写为

Assert.assertTrue("Sample Page".equals(NewPostPage.getTitle()),"Title did not match");

关于C# Assert.IsTrue 和 Assert.AreEquals 的 Java 替代代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34428698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com