Questions tagged [powermockrunner]
23 questions
0
votes
0 answers
JunitParams and PowerMockRunner null pointer exception
I can't figure out where the error is in my tests. I am using PowerMockRunner to simulate some static methods and JunitParams to add parameters to the test cases.
When I run the tests, I get the following error:
java.lang.NullPointerException
at…

Novice
- 423
- 1
- 9
- 17
0
votes
2 answers
Jacoco offline instrumentation not working in Java 11 for PowerMock tests
I am unable to get the code coverage in Java 11 for Powermock tests using Jacoco maven plugin. My version details are as below:
Java version: jdk-11.0.2
Maven version: maven 3.5.2
Jacoco maven plugin version: 0.8.5
Powermock version: 2.0.0-beta.5
I…

Snehashis
- 1
- 2
- 3
0
votes
0 answers
How to mock non static logger with PowerMock?
I have a class that looks like this:
class Service {
private final Logger lgr = LoggerFactory.getLogger(Service.class);
public void doService() {
lgr.info("Do Service");
}
}
public class Controller {
private final Logger…

user97
- 67
- 6
0
votes
0 answers
Custom runner for a test method, not at class level - Is it possible?
Is it possible to specify a custom runner per test method within a test class? That is:
Class SomeTests {
public void test1() {
}
public void test2() {
}
// For this test only, is it possible
// to specify a different runner, for
// example :…

CuriousMind
- 8,301
- 22
- 65
- 134
0
votes
2 answers
Trying to mock restClient external API but it is invoking the actual API in java
I am trying to mock restClient external API but it is invoking the actual API instead of mocking it.
Kindly help as I am not sure where I am going wrong.
I tried mocking the call and a few more other things but it didn't work.
public class…

Rahul
- 95
- 1
- 3
- 14
0
votes
0 answers
Integrating Powermock with kotlin for Instrumentation testing
I am trying to integrate Powermock with Kotlin to test date related logic using Calendar and shared preferences but i am always getting unresolved reference for Powermock but mockito object works fine.
I have tried integrating all the powermock…

S.Singh
- 21
- 2
0
votes
0 answers
PowerMock mock injected Authentication
i am using PowerMockRunner in a spring-boot application for testing. Everything is working but when my controllers actions definition contain someControllerMethod(..., Authentication auth, ...). Then auth is null and therefore some code is not…

patman
- 2,780
- 4
- 30
- 54
-1
votes
1 answer
Testing a method which calls a static method of a final class
I have been trying write a test method for a class which just makes a call to static method of a final Util class.
This is the class I am trying to test
public class Processor {
public Double calculateAmount(Double total, List…

Turan
- 1
- 2