playframework / playframework/play1

PowerMock support

Open
#1,285 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.6k
Forks
671
Avg merge
12d 15h
Merged PRs (30d)
1

Description

I try to test with PowerMock with these dependencies:

- org.mockito -> mockito-core 2.23.4
- org.powermock -> powermock-module-junit4 1.7.4
- org.powermock -> powermock-core 1.7.4
- org.powermock -> powermock-api-mockito2 1.7.4

and this code:

@RunWith(PowerMockRunner.class)
public class ContextProcessorUtilsTest extends UnitTest{
    @Test
    @PrepareOnlyThisForTest(ContextProcessorUtils.class)
    public void getSessionTriggers() {
        PowerMockito.mockStatic(ContextProcessorUtils.class);
    }
}

and this:

@RunWith(PowerMockRunner.class)
@PrepareForTest(ContextProcessorUtils.class)    
public class ContextProcessorUtilsTest extends UnitTest{
    @Test
    public void getSessionTriggers() {
        PowerMockito.mockStatic(ContextProcessorUtils.class);
    }
}

and the error:
A java.lang.ClassNotFoundException has been caught, utils.ContextProcessorUtilsTest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported test with mockito-core 2.23.4, PowerMock 1.7.4, PowerMockRunner, and ContextProcessorUtils. Read the resulting ClassNotFoundException for ContextProcessorUtilsTest and investigate the project's test integration; done should clarify whether PowerMock can be supported and what compatibility or usage guidance is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.