package org.mockito.usage.binding;

import org.junit.*;
import org.mockito.Mockito;

public class IncorectBindingPuzzleFixedTest {

    private DerivedInterface mock;
    
    @Before public void setup() {
        mock = Mockito.mock(DerivedInterface.class);
    }

    private class BaseMessage {}
    private class Message extends BaseMessage {}
    
    private interface BaseInteface {
        public void print(BaseMessage message);
    }

    private interface DerivedInterface extends BaseInteface {
        public void print(Message message);
    }
    
    private void print(BaseMessage message) {
        mock.print(message);
    }
    
    @Test
    public void overriddenInterfaceMethodNotWorking() throws Exception {
        Message message = new Message();
        print(message);
        Mockito.verify(mock).print(message);
    }
    
    @Test
    public void overriddenInterfaceMethodWorking() throws Exception {
        Message message = new Message();
        print(message);
        Mockito.verify(mock).print((BaseMessage)message);
    }
}
@@ -144,28 +144,24 @@
 private 
-Derived
+Base
 Inte
-r
 face moc
@@ -168,44 +168,56 @@
 k;%0D%0A
-    
 %0D%0A    
-@Before public void setup(
+private void setMock(DerivedInterface mock
 ) %7B%0D
@@ -229,51 +229,24 @@
     
+this.
 mock = 
-Mockito.mock(DerivedInterface.class)
+mock
 ;%0D%0A 
@@ -337,20 +337,16 @@
 age %7B%7D%0D%0A
-    
 %0D%0A    pr
@@ -546,28 +546,24 @@
 e);%0D%0A    %7D%0D%0A
-    
 %0D%0A    privat
@@ -628,36 +628,45 @@
 ssage);%0D%0A    %7D%0D%0A
+%0D%0A
     
+@Ignore
 %0D%0A    @Test%0D%0A   
@@ -728,32 +728,141 @@
 ws Exception %7B%0D%0A
+        DerivedInterface derivedMock = Mockito.mock(DerivedInterface.class);%0D%0A        setMock(derivedMock);%0D%0A
         Message 
@@ -927,33 +927,40 @@
  Mockito.verify(
-m
+derivedM
 ock).print(messa
@@ -972,20 +972,16 @@
 %0A    %7D%0D%0A
-    
 %0D%0A    @T
@@ -1056,32 +1056,145 @@
 tion %7B%0D%0A        
+DerivedInterface derivedMock = Mockito.mock(DerivedInterface.class);%0D%0A        setMock(derivedMock);%0D%0A        Base
 Message message 
@@ -1259,17 +1259,24 @@
 .verify(
-m
+derivedM
 ock).pri
@@ -1282,21 +1282,8 @@
 int(
-(BaseMessage)
 mess
@@ -1296,9 +1296,11 @@
 %0A    %7D%0D%0A
+%0D%0A
 %7D

verify execution on derived iterface mock but run in on a base interface