[ 
https://issues.apache.org/jira/browse/MRUNIT-213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14648609#comment-14648609
 ] 

Greg Temchenko edited comment on MRUNIT-213 at 7/31/15 2:06 AM:
----------------------------------------------------------------

I followed [~zman0900]'s comment and was able to proceed one step after 
another. I had to add couple more ignores: org.springframework.context and 
org.apache.log4j

After that I stuck with this message:
{code}
java.lang.ExceptionInInitializerError
        at 
org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter.<init>(ConditionalStackTraceFilter.java:17)
        at 
org.mockito.exceptions.base.MockitoException.filterStackTrace(MockitoException.java:30)
        at 
org.mockito.exceptions.base.MockitoException.<init>(MockitoException.java:19)
        at 
org.mockito.exceptions.misusing.MockitoConfigurationException.<init>(MockitoConfigurationException.java:18)
        at 
org.mockito.internal.configuration.ClassPathLoader.loadImplementations(ClassPathLoader.java:145)
        at 
org.mockito.internal.configuration.ClassPathLoader.findPluginImplementation(ClassPathLoader.java:110)
        at 
org.mockito.internal.configuration.ClassPathLoader.findPlatformMockMaker(ClassPathLoader.java:106)
        at 
org.mockito.internal.configuration.ClassPathLoader.<clinit>(ClassPathLoader.java:59)
        at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:21)
        at 
org.mockito.internal.configuration.injection.scanner.MockScanner.<init>(MockScanner.java:22)
        at 
org.mockito.internal.configuration.InjectingAnnotationEngine.injectMocks(InjectingAnnotationEngine.java:96)
        at 
org.powermock.api.mockito.internal.configuration.PowerMockitoInjectingAnnotationEngine.process(PowerMockitoInjectingAnnotationEngine.java:35)
        at 
org.powermock.api.extension.listener.AnnotationEnabler.injectSpiesAndInjectToSetters(AnnotationEnabler.java:57)
        at 
org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.powermock.reflect.internal.WhiteboxImpl.performMethodInvocation(WhiteboxImpl.java:1873)
        at 
org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:663)
        at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:415)
        at 
org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.injectMocksUsingAnnotationEnabler(PowerMockTestNGMethodHandler.java:75)
        at 
org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.invoke(PowerMockTestNGMethodHandler.java:47)
        at 
my.company.MRTest_$$_jvste0a_0.testMap(RawEventsTransferTest_$$_jvste0a_0.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
        at 
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
        at org.testng.TestRunner.runWorkers(TestRunner.java:1178)
        at org.testng.TestRunner.privateRun(TestRunner.java:757)
        at org.testng.TestRunner.run(TestRunner.java:608)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
        at org.testng.SuiteRunner.run(SuiteRunner.java:240)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)
        at org.testng.TestNG.run(TestNG.java:999)
        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
        at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.NullPointerException
        at 
org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:21)
        ... 55 more
{code}

I also used testNG instead, so I used those annotations:
{code}
@PrepareForTest(MyReducer.class)
@PowerMockIgnore({"javax.xml.*", "org.xml.sax.*", "org.apache.xerces.*", 
"org.springframework.context.*",
        "org.apache.log4j.*", "org.w3c.dom.*"})


... inside test:
    @ObjectFactory
    public IObjectFactory getObjectFactory() {
        return new org.powermock.modules.testng.PowerMockObjectFactory();
    }
{code}
(as explained on this page 
https://github.com/jayway/powermock/wiki/TestNG_usage) 


was (Author: soid):
I followed [~zman0900]'s comment and was able to proceed one step after 
another. I had to add couple more ignores: org.springframework.context and 
org.apache.log4j

After that I stuck with this message:
{code}
java.lang.ExceptionInInitializerError
        at 
org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter.<init>(ConditionalStackTraceFilter.java:17)
        at 
org.mockito.exceptions.base.MockitoException.filterStackTrace(MockitoException.java:30)
        at 
org.mockito.exceptions.base.MockitoException.<init>(MockitoException.java:19)
        at 
org.mockito.exceptions.misusing.MockitoConfigurationException.<init>(MockitoConfigurationException.java:18)
        at 
org.mockito.internal.configuration.ClassPathLoader.loadImplementations(ClassPathLoader.java:145)
        at 
org.mockito.internal.configuration.ClassPathLoader.findPluginImplementation(ClassPathLoader.java:110)
        at 
org.mockito.internal.configuration.ClassPathLoader.findPlatformMockMaker(ClassPathLoader.java:106)
        at 
org.mockito.internal.configuration.ClassPathLoader.<clinit>(ClassPathLoader.java:59)
        at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:21)
        at 
org.mockito.internal.configuration.injection.scanner.MockScanner.<init>(MockScanner.java:22)
        at 
org.mockito.internal.configuration.InjectingAnnotationEngine.injectMocks(InjectingAnnotationEngine.java:96)
        at 
org.powermock.api.mockito.internal.configuration.PowerMockitoInjectingAnnotationEngine.process(PowerMockitoInjectingAnnotationEngine.java:35)
        at 
org.powermock.api.extension.listener.AnnotationEnabler.injectSpiesAndInjectToSetters(AnnotationEnabler.java:57)
        at 
org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.powermock.reflect.internal.WhiteboxImpl.performMethodInvocation(WhiteboxImpl.java:1873)
        at 
org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:663)
        at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:415)
        at 
org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.injectMocksUsingAnnotationEnabler(PowerMockTestNGMethodHandler.java:75)
        at 
org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.invoke(PowerMockTestNGMethodHandler.java:47)
        at 
my.company.MRTest_$$_jvste0a_0.testMap(RawEventsTransferTest_$$_jvste0a_0.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
        at 
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
        at org.testng.TestRunner.runWorkers(TestRunner.java:1178)
        at org.testng.TestRunner.privateRun(TestRunner.java:757)
        at org.testng.TestRunner.run(TestRunner.java:608)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
        at org.testng.SuiteRunner.run(SuiteRunner.java:240)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)
        at org.testng.TestNG.run(TestNG.java:999)
        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
        at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.NullPointerException
        at 
org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:21)
        ... 55 more
{code}

I also used testNG instead, so I used those annotations:
{code}
@PrepareForTest(MyReducer.class)
@PowerMockIgnore({"javax.xml.*", "org.xml.sax.*", "org.apache.xerces.*", 
"org.springframework.context.*",
        "org.apache.log4j.*", "org.w3c.dom.*"})


... inside test:
    @ObjectFactory
    public IObjectFactory getObjectFactory() {
        return new org.powermock.modules.testng.PowerMockObjectFactory();
    }
{code}


> MultipleOutputs for Reducers throws Named output 'test' not defined
> -------------------------------------------------------------------
>
>                 Key: MRUNIT-213
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-213
>             Project: MRUnit
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: OSX, IntelliJ, CDH4.6.0
>            Reporter: John Conwell
>
> I pulled the unit test for testing multiple outputs for a reducer from the 
> patch of MRUNIT-13 and the test fails with the exception:
> java.lang.IllegalArgumentException: Named output 'test' not defined
>       at 
> org.apache.hadoop.mapreduce.lib.output.MultipleOutputs.checkNamedOutputName(MultipleOutputs.java:188)
>       at 
> org.apache.hadoop.mapreduce.lib.output.MultipleOutputs.write(MultipleOutputs.java:358)
>       at 
> org.apache.hadoop.mapreduce.lib.output.MultipleOutputs.write(MultipleOutputs.java:343)
> It looks like multiple reducer outputs needs to be setup in the Configuration 
> object the same way MultipleOutputs.addNamedOutput() does.
> I'm running cdh4.6.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to