[ACCEPTED]-Can Powermockito mock final method in non-final concrete class?-powermock
Accepted answer
This works :
@RunWith(PowerMockRunner.class)
@PrepareForTest(ABC.class)
public class ABCTest {
@Test
public void finalCouldBeMock() {
final ABC abc = PowerMockito.mock(ABC.class);
PowerMockito.when(abc.myMethod()).thenReturn("toto");
assertEquals("toto", abc.myMethod());
}
}
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.