PowerMock - Interview Questions and Answers for 'Powermock' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



PowerMock - Interview Questions and Answers for 'Powermock' - 6 question(s) found - Order By Newest

 Q1. Have you ever tried mocking static methods ?Testing
Ans. Yes, that can be done using Power Mock. Mockito doesnt provide a way to mock static methods.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Mockito  junit  powermock     Asked in 1 Companies


 Q2. Can we mock static methods using Mockito ?PowerMock
Ans. No, We can use PowerMock for that.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     mockito


 Q3. Have you ever used PowerMock ? If yes , which mocking framework you have used it with ?PowerMock
Ans. Yes, I have used PowerMockito with Mockito.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Mockito


 Q4. How can you verify if there were interactions with a static method using PowerMock ?PowerMock
Ans. We can use PowerMockito.verifyStatic for this purpose

PowerMockito.verifyStatic(VerificationModeFactory.times(1));
<Class_Name>.<static_method_name>;

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     mocking static methods


 Q5. What is doCallRealMethod() method used for ?PowerMock
Ans. When we Mock an object and then make a reference to any method using mocked object reference , java never makes a call to that method and looks for mocked value to be returned or null if none specified. But If we want that to be overridden and want java to make actual method call upon using mocked object reference, this method can be used.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     junit  mocking  java unit testing  Mockito


 Q6. Can we mock private methods ?PowerMock
Ans. Yes, using Power Mock.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     mockito  mocking  testing



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: