| 1 |
/* |
| 2 |
* Copyright (c) 2017 Mockito contributors |
| 3 |
* This program is made available under the terms of the MIT License. |
| 4 |
*/ |
| 5 |
package org.mockitoinline; |
| 6 |
|
| 7 |
import org.junit.Test; |
| 8 |
|
| 9 |
import static org.mockito.ArgumentMatchers.eq; |
| 10 |
import static org.mockito.Mockito.spy; |
| 11 |
import static org.mockito.Mockito.verify; |
| 12 |
|
| 13 |
public final class SuperCallTest { |
| 14 |
|
| 15 |
@Test |
| 16 |
public void testSuperMethodCall() { |
| 17 |
Dummy d = spy(new Dummy()); |
| 18 |
d.foo(); |
| 19 |
verify(d).bar(eq("baz")); |
| 20 |
} |
| 21 |
|
| 22 |
static class Dummy { |
| 23 |
|
| 24 |
public void foo() { |
| 25 |
bar("baz"); |
| 26 |
} |
| 27 |
|
| 28 |
// Also fails if public. |
| 29 |
void bar(String s) { |
| 30 |
return; |
| 31 |
} |
| 32 |
} |
| 33 |
} |