• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.mockitousage.bugs;
2 
3 import org.junit.Test;
4 
5 import static org.assertj.core.api.Assertions.assertThat;
6 import static org.mockito.Mockito.spy;
7 
8 public class ImplementationOfGenericAbstractMethodNotInvokedOnSpyTest {
9     public abstract class GenericAbstract<T> {
method_to_implement(T value)10         protected abstract String method_to_implement(T value);
11 
public_method(T value)12         public String public_method(T value) {
13             return method_to_implement(value);
14         }
15     }
16 
17     public class ImplementsGenericMethodOfAbstract<T extends Number> extends GenericAbstract<T> {
18         @Override
method_to_implement(T value)19         protected String method_to_implement(T value) {
20             return "concrete value";
21         }
22     }
23 
24     @Test
should_invoke_method_to_implement()25     public void should_invoke_method_to_implement() {
26         GenericAbstract<Number> spy = spy(new ImplementsGenericMethodOfAbstract<Number>());
27 
28         assertThat(spy.public_method(73L)).isEqualTo("concrete value");
29     }
30 }
31