I upgraded the MRUnit version to 1.1.0 in my project, to use the ReduceDriver for testing multiple outputs. After making changes to my test (to make it work with the upgrade), I get this error:
java.lang.VerifyError: Expecting a stackmap frame at branch target 63
Exception Details:
Location: (path to test class)
Reason: Expected stackmap frame at this location.
Bytecode: (Bytecode)
My test looks like this (have deliberately removed code to make this more concise):
@RunWith(PowerMockRunner.class)
@PrepareForTest(MultipleOutputs.class)
public class myReducerTest {
private ReduceDriver<Text, Text, Text, Text> reduceDriver;
@Before
public void setUp() {
reduceDriver = ReduceDriver.newReduceDriver(new myReducer());
}
@Test
public void testHappyPath() throws IOException {
/*
Code to declare input key, inout value, expected output, etc.
*/
reduceDriver.withInput(myInputKey, myInputVal);
reduceDriver.withMultiOutput("reportName1", key, expectedValue1);
reduceDriver.withMultiOutput("reportName2", key, expectedValue2);
reduceDriver.runTest();
}
}
I get the error when I use @PrepareForTest. Note that myReducer class has no static or final methods. That is why it is not included in @PrepareForTest annotation. Part of my pom file (I am using maven for building) looks like this:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>1.1.0</version>
<classifier>hadoop2</classifier>
<scope>test</scope>
</dependency>
Also note that I am using Java 8, and cannot downgrade to v7 or v6 as mentioned here: java.lang.VerifyError: Expecting a stackmap frame at branch target
I also tried adding the surefire plugin in the pom file, as mentioned here: java.lang.VerifyError: Expecting a stackmap frame at branch target 73
None of these solutions work in this case.