Skip to content

Use kotlin-test asserters#142

Merged
bubelov merged 1 commit intobubelov:masterfrom
ebraminio:kotlin-test
Apr 9, 2022
Merged

Use kotlin-test asserters#142
bubelov merged 1 commit intobubelov:masterfrom
ebraminio:kotlin-test

Conversation

@ebraminio
Copy link
Copy Markdown
Contributor

@ebraminio ebraminio commented Apr 6, 2022

As it provides more Kotlin idiomatic asserters than Java asserters.

  • Provides assertIs<T>(value) instead having to write assertTrue(value is T)
  • Has a assertContentEquals which works with iterables instead requiring arrays like assertArrayEquals
  • assertFails instead current assertThrows(Exception::class.java) which forces you to specify the type, there is a assertFailsWith also when a type is needed.
  • Provides IDE lint when assertEquals can be used instead assertTrue and etc

val worker = workerBuilder.build()
val result = worker.doWork()
Assert.assertTrue(result is ListenableWorker.Result.Retry)
assertIs<ListenableWorker.Result.Retry>(result)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that this is already broken on master and this won't change that breakage.

As it provides more Kotlin idiomatic asserters than Java asserters.
@bubelov bubelov merged commit 571b28f into bubelov:master Apr 9, 2022
@ebraminio ebraminio deleted the kotlin-test branch April 9, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants