Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use kotlin-test asserters #142

Merged
merged 1 commit into from
Apr 9, 2022
Merged

Use kotlin-test asserters #142

merged 1 commit into from
Apr 9, 2022

Conversation

ebraminio
Copy link
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

@@ -26,6 +27,6 @@ class SyncWorkerTest {
val workerBuilder = TestWorkerBuilder.from(targetContext, SyncWorker::class.java)
val worker = workerBuilder.build()
val result = worker.doWork()
Assert.assertTrue(result is ListenableWorker.Result.Retry)
assertIs<ListenableWorker.Result.Retry>(result)
Copy link
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