Due to the fact that I wanted to use Categories from JUnit on my tests I had to rewrite some mocked tests with PowerMock (powermock on top of EasyMock to mock statics). From RunWith(PowermockRunner.class) to the below;
@Category(ServerTests.class)
@PrepareForTest(EnvironmentConfig.class)
@PowerMockIgnore( {"javax.management.*", "org.w3c.dom.*", "org.apache.log4j.*", "org.xml.sax.*", "javax.xml.*"})
public class JmsHelperTest {
@Rule
public PowerMockRule rule = new PowerMockRule();
}
Unfortunately I already suppressed a few error with the PowerMockIgnore, but the last I cannot suppress and I hope you can help.
The error:
ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider jdk.nashorn.api.scripting.NashornScriptEngineFactory not a subtype ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider jdk.nashorn.api.scripting.NashornScriptEngineFactory not a subtype 2017-06-09 13:37:24,660 main ERROR No ScriptEngine found for language javascript. Available languages are: 2017-06-09 13:37:24,776 main WARN No script named {} could be found
for reference the loaded packages;
import mypackage.EnvironmentConfig;
import mypackage.category.ServerTests;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
import static org.easymock.EasyMock.expect;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.powermock.api.easymock.PowerMock.mockStatic;
import static org.powermock.api.easymock.PowerMock.replay;
I was focussing on the jdk.nashorn.*
, however when I add javax.script.*
to the @PowerMockIgnore
it solved the errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With