代码之家  ›  专栏  ›  技术社区  ›  Mario Kutlev Domi

AssertJ库是否有Kotlin等价物?[已关闭]

  •  18
  • Mario Kutlev Domi  · 技术社区  · 8 年前

    org.jetbrains.kotlin:kotlin-test-junit )断言集非常有限。

    对于资产J是否有Kotlin等价物或更好的资产方式?

    我找到了 Kluent library

    2 回复  |  直到 8 年前
        1
  •  21
  •   Grzegorz Piwowarek    8 年前

    没有官方的等价物,但基本AssertJ在许多情况下仍然可用,看起来相当不错:

    assertThat(info)
      .containsKey("foo")
    
    
    assertThatThrownBy { session.restTemplate.postForLocation("foo", {}) }
      .isExactlyInstanceOf(HttpClientErrorException::class.java)
    

    https://github.com/wuan/assertj-core-kotlin

        2
  •  8
  •   Robert Stoll    7 年前

    您可能不再搜索断言库,但如果您对当前的选择不满意,请查看 https://github.com/robstoll/atrium

    • 断言组
    • 可为null类型的断言函数
    • 方法断言
    • 假设扔了一个可丢弃的东西

    以及更高级的功能,如复杂的断言生成器、对i18n的支持等等。

    https://github.com/robstoll/atrium/blob/master/README.md#examples

    推荐文章