File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
scala-test/src/test/scala/com/baeldung/scala/scalatest/mockito Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,11 @@ class InventoryServiceTest extends AnyWordSpec with MockitoSugar with ScalaFutur
56
56
when(dao.saveAsync(any[InventoryTransaction ])).thenReturn(Future .successful(txn))
57
57
when(mockProducer.publish(any[InventoryTransaction ])).thenThrow(new RuntimeException (" This should never occur" ))
58
58
val result = service.saveAndPublish(txn)
59
- whenReady(result) {
59
+ whenReady(result) { _ =>
60
60
verify(mockProducer, times(0 )).publish(any[InventoryTransaction ])
61
61
verify(mockProducer, never).publish(any[InventoryTransaction ])
62
62
}
63
+
63
64
}
64
65
65
66
" save and log the txn details" in {
@@ -71,7 +72,7 @@ class InventoryServiceTest extends AnyWordSpec with MockitoSugar with ScalaFutur
71
72
val service = new InventoryService (dao, mockProducer, mockLogger)
72
73
when(dao.saveAsync(any[InventoryTransaction ])).thenReturn(Future .successful(txn))
73
74
val result = service.saveAndLogTime(txn)
74
- whenReady(result) {
75
+ whenReady(result) { _ =>
75
76
val refCapture = ArgumentCaptor .forClass(classOf [String ])
76
77
val refLocalDateTime = ArgumentCaptor .forClass(classOf [LocalDateTime ])
77
78
You can’t perform that action at this time.
0 commit comments