when(mongoCollection.updateOne(new Document("_id", anyString()), new Document("$set", new Document("_id", anyString()).append("funds", anyInt())), any(UpdateOptions.class)))
.then(i -> fundsByAccount.put(i.getArgument(0), i.getArgument(2)));
I have this java code i take in 4 matchers, but only 3 is expected, the first anyString()
call and the second should be same, i want to reuse it so that i'll be able to do this in only 3 matchers call.
when(mongoCollection.updateOne(new Document("_id", anyString()), new Document("$set", any(Document.class).append("funds", anyInt())), any(UpdateOptions.class)))
.then(i -> fundsByAccount.put(i.getArgument(0), i.getArgument(2)));
I tried this but again this takes in 4 matcher calls, i need some way to reuse already captured values