Java 类org.mockito.exceptions.misusing.UnfinishedVerificationException 实例源码
项目:astor
文件:InvalidStateDetectionTest.java
@Test
public void shouldDetectUnfinishedVerification() {
verify(mock);
detectsAndCleansUp(new OnStub(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnStubVoid(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerify(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyInOrder(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyZeroInteractions(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyNoMoreInteractions(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnDoAnswer(), UnfinishedVerificationException.class);
}
项目:astor
文件:InvalidStateDetectionTest.java
@Test
public void shouldDetectUnfinishedVerification() {
verify(mock);
detectsAndCleansUp(new OnStub(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnStubVoid(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerify(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyInOrder(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyZeroInteractions(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnVerifyNoMoreInteractions(), UnfinishedVerificationException.class);
verify(mock);
detectsAndCleansUp(new OnDoAnswer(), UnfinishedVerificationException.class);
}
项目:astor
文件:Reporter.java
public void unfinishedVerificationException(Location location) {
UnfinishedVerificationException exception = new UnfinishedVerificationException(join(
"Missing method call for verify(mock) here:",
location,
"",
"Example of correct verification:",
" verify(mock).doSomething()",
"",
"Also, this error might show up because you verify either of: final/private/equals()/hashCode() methods.",
"Those methods *cannot* be stubbed/verified.",
""
));
throw exception;
}
项目:astor
文件:ExplicitFrameworkValidationTest.java
@Test
public void shouldValidateExplicitly() {
verify(mock);
try {
Mockito.validateMockitoUsage();
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:DetectingFinalMethodsTest.java
@Test
public void shouldFailWithUnfinishedVerification() {
withFinal = mock(WithFinal.class);
verify(withFinal).foo();
try {
verify(withFinal).foo();
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:DetectingMisusedMatchersTest.java
@Test
public void shouldSayUnfinishedVerificationButNotInvalidUseOfMatchers() {
verify(withFinal).finalMethod(anyObject());
try {
verify(withFinal);
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:ResetTest.java
@Test
public void shouldValidateStateWhenResetting() {
//invalid verify:
verify(mock);
try {
reset(mockTwo);
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:ClickableStackTracesWhenFrameworkMisusedTest.java
@Test
public void shouldShowWhereIsUnfinishedVerification() throws Exception {
unfinishedVerificationHere();
try {
mock(IMethods.class);
fail();
} catch (UnfinishedVerificationException e) {
assertContains("unfinishedVerificationHere(", e.getMessage());
}
}
项目:astor
文件:FindingRedundantInvocationsInOrderTest.java
@Test
public void shouldValidateState() throws Exception {
//when
InOrder inOrder = inOrder(mock);
verify(mock); // mess up state
//then
try {
inOrder.verifyNoMoreInteractions();
fail();
} catch(UnfinishedVerificationException e) {}
}
项目:astor
文件:InvalidStateDetectionTest.java
@Test
public void shouldCorrectStateAfterDetectingUnfinishedVerification() {
mock.simpleMethod();
verify(mock);
try {
verify(mock).simpleMethod();
fail();
} catch (UnfinishedVerificationException e) {}
verify(mock).simpleMethod();
}
项目:astor
文件:ExplicitFrameworkValidationTest.java
@Test
public void shouldValidateExplicitly() {
verify(mock);
try {
Mockito.validateMockitoUsage();
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:DetectingFinalMethodsTest.java
@Test
public void shouldFailWithUnfinishedVerification() {
withFinal = mock(WithFinal.class);
verify(withFinal).foo();
try {
verify(withFinal).foo();
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:DetectingMisusedMatchersTest.java
@Test
public void shouldSayUnfinishedVerificationButNotInvalidUseOfMatchers() {
verify(withFinal).finalMethod(anyObject());
try {
verify(withFinal);
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:ResetTest.java
@Test
public void shouldValidateStateWhenResetting() {
//invalid verify:
verify(mock);
try {
reset(mockTwo);
fail();
} catch (UnfinishedVerificationException e) {}
}
项目:astor
文件:ClickableStackTracesWhenFrameworkMisusedTest.java
@Test
public void shouldShowWhereIsUnfinishedVerification() throws Exception {
unfinishedVerificationHere();
try {
mock(IMethods.class);
fail();
} catch (UnfinishedVerificationException e) {
assertContains("unfinishedVerificationHere(", e.getMessage());
}
}
项目:astor
文件:FindingRedundantInvocationsInOrderTest.java
@Test
public void shouldValidateState() throws Exception {
//when
InOrder inOrder = inOrder(mock);
verify(mock); // mess up state
//then
try {
inOrder.verifyNoMoreInteractions();
fail();
} catch(UnfinishedVerificationException e) {}
}
项目:astor
文件:InvalidStateDetectionTest.java
@Test
public void shouldCorrectStateAfterDetectingUnfinishedVerification() {
mock.simpleMethod();
verify(mock);
try {
verify(mock).simpleMethod();
fail();
} catch (UnfinishedVerificationException e) {}
verify(mock).simpleMethod();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java
@Test(expected = UnfinishedVerificationException.class)
public void verifyShouldUseProxyTarget() throws Exception {
this.dateService.getDate();
verify(this.dateService, times(1)).getDate();
reset(this.dateService);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:MockBeanWithAopProxyAndNotProxyTargetAwareTests.java
@Test(expected = UnfinishedVerificationException.class)
public void verifyShouldUseProxyTarget() throws Exception {
this.dateService.getDate();
verify(this.dateService, times(1)).getDate();
reset(this.dateService);
}
项目:spring-boot-concourse
文件:SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java
@Test(expected = UnfinishedVerificationException.class)
public void verifyShouldUseProxyTarget() throws Exception {
this.dateService.getDate();
verify(this.dateService, times(1)).getDate();
reset(this.dateService);
}
项目:spring-boot-concourse
文件:MockBeanWithAopProxyAndNotProxyTargetAwareTests.java
@Test(expected = UnfinishedVerificationException.class)
public void verifyShouldUseProxyTarget() throws Exception {
this.dateService.getDate();
verify(this.dateService, times(1)).getDate();
reset(this.dateService);
}