Questions tagged [verify]
676 questions
421
votes
2 answers
How to verify a method is called two times with mockito verify()
I want to verify if a method is called at least once through mockito verify. I used verify and it complains like this:
org.mockito.exceptions.verification.TooManyActualInvocations:
Wanted 1 time:
But was 2 times. Undesired invocation:

Ahmad Beg
- 4,285
- 3
- 14
- 5
184
votes
1 answer
Java verify void method calls n times with Mockito
I'm trying to verify that a (void) method is being called inside of a DAO - I'm using a commit point that sends a list of results up to that point, resets the list and continues.
Say I have 4 things in the list and I have a commit point of 1, I…

nbpeth
- 2,967
- 4
- 24
- 34
107
votes
4 answers
How to verify downloaded file with .sig file?
When I download GCC, it also has a .sig file, and I think it is provided to verify downloaded file.
(I downloaded GCC from here).
But I can't figure out how should I use it. I tried gpg, but it complains about public key.
[root@localhost src]# gpg…

eonil
- 83,476
- 81
- 317
- 516
55
votes
7 answers
Javascript Image Url Verify
I need to verify an image url to check whether the url is an image of any of these extensions:- jpeg, jpg, gif, png. Example:- when we verify this url http://www.example.com/asdf.jpg it should give us true value and with url like this…

John Preston
- 765
- 3
- 8
- 11
52
votes
5 answers
Moq - Is it possible to specify in a Setup the Verify criteria (e.g. Times called)?
If you need to Setup a return value, as well as Verify how many times the expression was called, can you do this in one statement?
From what I can gather, Moq's Setup(SomeExpression).Verifiable() called along with Verify(), basically does a…

GregS
- 681
- 1
- 6
- 8
44
votes
4 answers
openssl verify - error 20 at 0 depth lookup:unable to get local issuer certificate
i created a PEM certificate from a PFX certificate and wanted to verify it.
However i ran into this issue, try to find some answers, but i didnt and therefore i dont know how to fix it.
could you please advice?
thank you very…

spaghi
- 471
- 1
- 4
- 4
43
votes
6 answers
Openssl : error "self signed certificate in certificate chain"
When I used openssl APIs to validate server certificate (self signed), I got following error :
error 19 at 1 depth lookup:self signed certificate in certificate
chain
As per openssl documentation, this error (19) is…

Lunar Mushrooms
- 8,358
- 18
- 66
- 88
37
votes
7 answers
Is there a way of having something like jUnit Assert message argument in Mockito's verify method?
Let's assume a snippet of testing code:
Observable model = Class.forName(fullyQualifiedMethodName).newInstance();
Observer view = Mockito.mock(Observer.class);
model.addObserver(view);
for (Method method :…

Boris Pavlović
- 63,078
- 28
- 122
- 148
36
votes
10 answers
Best way to check that element is not present using Selenium WebDriver with java
Im trying the code below but it seems it does not work... Can someone show me the best way to do this?
public void verifyThatCommentDeleted(final String text) throws Exception {
new WebDriverWait(driver, 5).until(new ExpectedCondition()…

Roman Iuvshin
- 1,872
- 10
- 24
- 40
34
votes
9 answers
Verify email in Java
Is there any way to verify in Java code that an e-mail address is valid. By valid, I don't just mean that it's in the correct format (someone@domain.subdomain), but that's it's a real active e-mail address.
I'm almost certain that there's no 100%…

Dónal
- 185,044
- 174
- 569
- 824
25
votes
2 answers
Verify method call with Lambda expression - Moq
I have a Unit of Work implementation with, among others, the following method:
T Single(Expression> expression) where T : class, new();
and I call it, for instance, like this:
var person = _uow.Single(p => p.FirstName ==…

Sergi Papaseit
- 15,999
- 16
- 67
- 101
24
votes
3 answers
Verifying a method was called
Using Moq, I have a very odd issue where the setup on a mock only seems to work if the method I am setting up is public. I don't know if this is a Moq bug or if I just have this wrong (newbie to Moq). Here is the test case:
public class…

jle
- 432
- 1
- 5
- 11
23
votes
1 answer
What does the Maven verify command do?
It says in the documentation
that the verify phase in the build lifecycle
run any checks on results of integration tests to ensure quality criteria are met
What does this exactly mean?

kaka
- 597
- 3
- 5
- 16
22
votes
5 answers
How to verify X509 cert without importing root cert?
My program contains 2 root certs I know and trust.
I have to verify certs of trustcenters and "user" certs issued by the trustcenters which all originate from these 2 root certs.
I use X509Chain class to verify but that only works if the root cert…

RainerM
- 695
- 3
- 7
- 10
22
votes
1 answer
How to verify call on setter in kotlin using mockito?
interface LoginDisplay {
var username: String
var password: String
}
class LoginActivityLoginDisplay : LoginDisplay {
override var username: String
get() = usernameEditView.text.toString()
set(value) {
…

przebar
- 531
- 1
- 5
- 19