Skip to content

Commit

Permalink
Bump to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Mar 25, 2022
1 parent 0cb82dc commit 4cb3339
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:toc: preamble
:toclevels: 3
:icons: font
:version: 1.3.0
:version: 1.4.0
:ksp-version: 1.6.0-1.0.4

A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.
Expand Down Expand Up @@ -149,6 +149,7 @@ Available constraints are:
- `isNull` and `isNotNull` check nullability.
- `isEqual` and `isNotEqual` check regular equality.
- `isSame` and `isNotSame` check identity.
- `isInstanceOf` checks type.

Note that passing a non-constraint value to the function is equivalent to passing `isEqual(value)`

Expand Down Expand Up @@ -446,6 +447,20 @@ val user = fakeUser().copy(id = 42)
====


==== Providing fake instances

Classes that do not have a public constructor cannot be automatically faked.
For these types, you need to provide your custom fake provider with `@FakeProvider`:

[source,kotlin]
----
@FakeProvider
fun provideFakeInstant() = Instant.fromEpochSeconds(0)
----

CAUTION: There can be only one provider per type, and it needs to be a top-level function.


=== Injecting your tests

Instead of creating your own mocks & fakes, it can be useful to inject them in your test class, especially if you have multiple tests using them.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ val kspVersion by extra { "1.6.10-1.0.4" }

allprojects {
group = "org.kodein.mock"
version = "1.3.0"
version = "1.4.0"
}

0 comments on commit 4cb3339

Please sign in to comment.