As I need to test publish function parameter passed is correct using Mockk in Kotlin
Below is the code :
val notificationData = NotificationData(
notificationId = "test-notificationID",
operation = "CREATE",
partnerName = "test-partner",
created = Instant.now().toEpochMilli().toString(),
services = []
)
verify(exactly = 1) { publish(notificationData) }
But as the created attribute in notificationData object will be having real time value in mock as well as in called function, both are not matching and giving below error
Verification failed: call 1 of 1: publish(eq(NotificationData(notificationId=test-notificationId, partnerName=test-partner, operation=CREATE, mutatedAttributes=null, services=[], created=1633719398360)))). Only one matching call to Notification(object Notification)/publish(NotificationData) happened, but arguments are not matching: [0]: argument: NotificationData(notificationId=test-notificationId, partnerName=test-partner, operation=CREATE, mutatedAttributes=null, services=[], created=1633719398404), matcher: eq(NotificationData(notificationId=test-notificationId, partnerName=test-partner, operation=CREATE, mutatedAttributes=null, services=[], created=1633719398360)), result: -
Anyone please help me to find out, how can I ignore the "created" attribute to get test successful