Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ void testStartHasBeenFired(Description d) {
}

void testInstanceCreated(Object newTestInstance) {
// Prevent double trigger on same instance
if (currentTestInstance == newTestInstance) {
return;
}
switch (behaviour) {
case PENDING:
behaviour = DetectedTestRunBehaviour.TEST_INSTANCE_CREATED_FIRST;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package samples.powermockito.junit4.bugs.github660;

public class AClass {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package samples.powermockito.junit4.bugs.github660;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.mockito.Mockito;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;

import java.io.PrintStream;

public class ChildTest extends ParentTest{

protected PrintStream outMock;

public ChildTest(){
super();
outMock = Mockito.mock(PrintStream.class);
System.setErr(outMock);

}
@Test
public void test_A(){
Mockito.verify(outMock,Mockito.times(0)).println("Notifications are not supported when all test-instances are created first!");
}

@Test
public void test_B(){
Mockito.verify(outMock,Mockito.times(0)).println("Notifications are not supported when all test-instances are created first!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package samples.powermockito.junit4.bugs.github660;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;

import java.io.PrintStream;

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(BlockJUnit4ClassRunner.class)
@PrepareForTest(AClass.class)
@Ignore
public class ParentTest {

}