Problem with 1.9-SNAPSHOT and mockito

33 views
Skip to first unread message

Jeppe Nejsum Madsen

unread,
Mar 13, 2012, 8:27:48 AM3/13/12
to specs2...@googlegroups.com
Hi

After upgrading from 1.8.2 to 1.9-SNAPSHOT, it seems mockito
verification no longer works.

"delete records before saving, when there is no matching id" in new TestNodes {
val daoMock = mock[OrgUnitDAO]
daoMock.get(999) returns Full(rootOU)
daoMock.create("newnode", "999") returns ou42
daoMock.create("newchild", "999.42") returns ou44
service(daoMock).saveAll(account, CompanyNode(999, "root",
List(CompanyNode(0, "newnode", List(child2.copy(children =
List(child3.copy())), CompanyNode(0, "newchild"))), child5)))

there were one(daoMock).deleteAllExcept_!(rootOU, 2, 999,2,3,5)
then 4.times(daoMock).update(anyLong, anyString, anyString)
}

This example fails with 1.8.2 but succeeds with 1.9-SNAPSHOT.

The (correct) error I see in 1.8.2 is:

java.lang.Exception: The mock was not called as expected:
Argument(s) are different! Wanted:
orgUnitDAO.deleteAllExcept_$bang(
OrgUnit(,),
WrappedArray(2, 999, 2, 3, 5)
);
-> at fleetzone.unittest.service.CompanyStructureSpec$$anonfun$39$$anonfun$apply$36$$anon$16$$anonfun$61$$anonfun$apply$3.apply$mcV$sp(CompanyStructureSpec.scala:202)
Actual invocation has different arguments:
orgUnitDAO.deleteAllExcept_$bang(
OrgUnit(,),
List(999, 2, 3, 5)
);
-> at fleetzone.service.CompanyStructureService$$anonfun$saveAll$1.apply(CompanyStructureService.scala:283)

/Jeppe

etorreborre

unread,
Mar 13, 2012, 5:58:32 PM3/13/12
to specs2...@googlegroups.com
That's a regression from my tentative to enable the mocking of implicitly converted parameters.

Please try the latest 1.9-SNAPSHOT.

Thanks,

Eric.

Jeppe Nejsum Madsen

unread,
Mar 14, 2012, 11:40:57 AM3/14/12
to specs2...@googlegroups.com
On Tue, Mar 13, 2012 at 10:58 PM, etorreborre <etorr...@gmail.com> wrote:
> That's a regression from my tentative to enable the mocking of implicitly
> converted parameters.
>
> Please try the latest 1.9-SNAPSHOT.

Works, thanks!

/Jeppe

Reply all
Reply to author
Forward
0 new messages