ile Specs2 belirli dize matchers ile invokations nasıl doğrularım ben bu satırlar boyunca bir test var:Ben Mockito
httpClient.post(anyString, anyString) returns (first, second)
//do my thing
there were two(httpClient).post(anyString, anyString)
Bu iyi çalışır, ancak ilk çağrı farklı bir vücuda geçer doğrulamak istiyorum ikinci arama. Vücut oldukça büyük ve sıkı bir örnek üzerinde kesin eşleme yapmak istemiyorum. Mockito yapar
there was one(httpClientMock).postMessage(anyString, argThat(contain("FOO"))
there was one(httpClientMock).postMessage(anyString, argThat(contain("FOO"))
şikayet:
InvalidUseOfMatchersException:
[error] Invalid use of argument matchers!
[error] 2 matchers expected, 3 recorded:
Ben de denedim: Bu denedim sonuçlanır
there was one(httpClientMock).postMessage(argThat(contain("foo")), argThat(contain("FOO")))
there was one(httpClientMock).postMessage(argThat(contain("foo")), argThat(contain("FOO")))
:
Wanted 1 time:
[error] -> ...
[error] But was 2 times. Undesired invocation: ...
O Bana böyle bir şey possi olmalı Biraz ama bunu anlayamıyorum. Insights?
Bunun mümkün olduğunu şüphe yoktu. Her zamanki gibi, sorduğuma sevindim :) – iwein
Scala için Mockito'nun alternatifi olmalı mı sorusunu soruyor? – iwein
Bir alternatif var: http://scalamock.org. Ama bu bir hata ise Mockito posta listesine sorabilirsiniz. Bu durumda onu düzeltebilirler. – Eric