Skip to content

Commit 962313d

Browse files
committed
Merge branch '1.5.x'
2 parents c4779a1 + abb8e36 commit 962313d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2012-2016 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.test.mock.mockito;
18+
19+
import org.junit.Test;
20+
import org.junit.runner.JUnitCore;
21+
import org.junit.runner.Result;
22+
import org.junit.runner.RunWith;
23+
import org.junit.runner.notification.Failure;
24+
25+
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
26+
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
27+
28+
import static org.assertj.core.api.Assertions.assertThat;
29+
30+
/**
31+
* Tests for compatibility with Mockito 2.5
32+
*
33+
* @author Andy Wilkinson
34+
* @author Phillip Webb
35+
*/
36+
@RunWith(ModifiedClassPathRunner.class)
37+
@ClassPathOverrides("org.mockito:mockito-core:2.5.4")
38+
public class Mockito25Tests {
39+
40+
@Test
41+
public void resetMocksTestExecutionListenerTestsWithMockito2() {
42+
runTests(ResetMocksTestExecutionListenerTests.class);
43+
}
44+
45+
@Test
46+
public void spyBeanWithAopProxyTestsWithMockito2() {
47+
runTests(SpyBeanWithAopProxyTests.class);
48+
}
49+
50+
private void runTests(Class<?> testClass) {
51+
Result result = new JUnitCore().run(testClass);
52+
for (Failure failure : result.getFailures()) {
53+
System.err.println(failure.getTrace());
54+
}
55+
assertThat(result.getFailureCount()).isEqualTo(0);
56+
assertThat(result.getRunCount()).isGreaterThan(0);
57+
}
58+
59+
}

0 commit comments

Comments
 (0)