mnky4a6 / powermock Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/powermock
License: Apache License 2.0
Automatically exported from code.google.com/p/powermock
License: Apache License 2.0
There seems to be a problem with cobertura, Maven and PowerMock.
For example adding cobertura to the DocumentationExamples project results
in the following error message (on Linux as well after configuring surefire
with cobertura.use.java.nio to false):
Cobertura: Loaded information on 5 classes.
Cobertura: Coverage data file
/home/johan/devtools/java/projects/powermock/examples/DocumentationExamples/targ
et/cobertura/cobertura.ser
either does not exist or is not readable. Creating a new data file.
Cobertura: Error reading file
/home/johan/devtools/java/projects/powermock/examples/DocumentationExamples/targ
et/cobertura/cobertura.ser:
null
Cobertura: Saved information on 1 classes.
Cobertura: Error reading file
/home/johan/devtools/java/projects/powermock/examples/DocumentationExamples/targ
et/cobertura/cobertura.ser:
null
Cobertura: Coverage data file
/home/johan/devtools/java/projects/powermock/examples/DocumentationExamples/targ
et/cobertura/cobertura.ser
either does not exist or is not readable. Creating a new data file.
Cobertura: Saved information on 5 classes.
Cobertura: Saved information on 1 classes.
[INFO] [cobertura:cobertura]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
[cobertura] INFO [main]
net.sourceforge.cobertura.reporting.html.HTMLReport - Data file does not
contain instrumentation information for the file
powermock/examples/staticmocking/ServiceRegistrator.java. Ensure this
class was instrumented, and this data file contains the instrumentation
information.
Report time: 119ms
We need to address this if possible.
Original issue reported on code.google.com by [email protected]
on 1 Oct 2008 at 7:13
Whitebox.invokeMethod should be able to execute a private method in
somewhere in the class hierarchy. For example if one creates an anonymous
inner class of the class under test to override some public methods you'd
still like to be able to invoke private methods in the "concrete class".
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 12:51
WhiteBox doInvokeMethod can remove methodToInvoke.setAccessible(true)
because this is done in the performMethodInvocation method.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 7:05
Idea, netbeans
Original issue reported on code.google.com by [email protected]
on 22 Sep 2008 at 6:04
createPartialMock should support nice and strict mocks as well
Original issue reported on code.google.com by [email protected]
on 26 Oct 2008 at 7:44
If we do expectNew(MyClass.class) once but it's called twice we should get
a more descriptive error message than the following:
java.lang.RuntimeException: java.lang.AssertionError:
Unexpected method call createInstance():
createInstance(): expected: 1, actual: 1 (+1)
at org.powermock.Whitebox.performMethodInvocation(Whitebox.java:788)
at org.powermock.Whitebox.invokeMethod(Whitebox.java:268)
at se.myapp.MyTest.testCreateDomainTarget(MyTest.java:577)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
We could perhaps catch the AssertionError in MockGateway line 117 ( return
newInvocationControl.createInstance()) and throw another AssertionError
with a better description instead.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 8:59
Using WhiteBox.invokeConstructor(..) doesn't work in combination with
suppressConstructorCode (the constructor is still invoked without being
suppressed).
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 7:09
It would be cool to support "recursive partial mocking".
Imagine this:
void addFolderToLogPaths(final File logFolder, final List<LogFile> logFileList,
final Collection<ITargetPersistenceUnit> persistentUnits) {
if (!logFolder.isDirectory()) {
throw new IllegalArgumentException("logPath is not a directory.");
}
final File[] allLogFiles = logFolder.listFiles();
for (File fileOrDirectory : allLogFiles) {
if (fileOrDirectory.isDirectory()) {
addFolderToLogPaths(fileOrDirectory, logFileList,
persistentUnits);
} else {
logFileList.add(new
LogFile(getRelativeLogPath(fileOrDirectory), fileOrDirectory.lastModified(),
isFileReplayable(persistentUnits, fileOrDirectory)));
}
}
}
We could implement so that one call to addFolderToLogPaths (the actual test
invocation) passes the MockGateway but sequential invocations should be
mocked.
Original issue reported on code.google.com by [email protected]
on 1 Oct 2008 at 12:54
When the test class extends TestCase the setUp and TearDown metods are not
executed when running with the PowerMockRunner. A work-around exists (use
the @Before and @After annotations and change the mehtods to public
instread of protected).
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 12:44
If we have a class like this:
public final class SomeHelper {
private SomeHelper() {
}
static class MyPlugin extends MyCorePlugin {
public MyPlugin() {
setLogManager(new MockLogManager());
}
}
...
}
and load the classes are loaded from our classloader the MockGateway
performs a check, suppressMethod.contains(Whitebox.getMethod(objectType,
methodName, sig)), for the MyPlugin invokation of the setLogManager method.
However if setLogManager is protected the Whitebox.getMethod(..) won't find
the method because it's neither public or private. We need to address this!!
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 3:25
We should add suppressMethod(Class<?> clazz, String...methodNamesToSuppress);
Original issue reported on code.google.com by [email protected]
on 26 Sep 2008 at 7:02
Investigate if it's possible to maintain a list of all mock objects created
by powermock. This would enable replayAll() and verifyAll().
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 12:27
verify calls verifyClass which clears the state! We need to refactor
verifyClass to a new private method that doesn't clear state.
verify(object...) and verifyClass should call this new method (the old
verifyClass _should_ clear state though).
This happens when you do PowerMock.verify(MyClass.class, myInstance,
myInstance2); Before myInstance has been verified the PowerMock state has
been cleared.
Original issue reported on code.google.com by [email protected]
on 9 Sep 2008 at 1:43
This doesn't work:
expectPrivate(tested, getNewStringBuilderMethodName,
aryEq(message)).andReturn(expected);
It will produce:
java.lang.NullPointerException
at org.powermock.Whitebox.findMethodOrThrowException(Whitebox.java:364)
at org.powermock.PowerMock.expectPrivate(PowerMock.java:714)
at
se.myapp.service.model.LineSplitDataPackageWriterTest.testWrite_singleMessageWit
hNewLine(LineSplitDataPackageWriterTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadi
e.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.in
vokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:162)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
nMethods(PowerMockJUnit44RunnerDelegateImpl.java:119)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.
run(PowerMockJUnit44RunnerDelegateImpl.java:112)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
n(PowerMockJUnit44RunnerDelegateImpl.java:110)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run
(JUnit4TestSuiteChunkerImpl.java:74)
at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.
run(AbstractCommonPowerMockRunner.java:43)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
Original issue reported on code.google.com by [email protected]
on 9 Sep 2008 at 2:58
Our test runner runs the tests in a different order than the default junit
runner. This should be fixed.
Original issue reported on code.google.com by [email protected]
on 26 Oct 2008 at 7:41
The new constructor suppression algorithm doesn't work for classes that
directly extend from java.lang.Object since Object doesn't contain a ctor
with with argument IndicateReloadClass. We must change the implementation
in the MainMockTransformers' edit(ConstructorCall c) method to check if the
super class is of type Object before defering the call.
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 1:05
Upgrade to javassist 3.9
Original issue reported on code.google.com by [email protected]
on 12 Oct 2008 at 7:36
In EasyMock 2.4 you explicitly need to tell the mock whether it should be
used in multiple threads or not. We need to investigate if we need add a
makeThreadSafe method in our API or if you can use makeThreadSafe from
class extension on our mocks.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2008 at 9:27
Upload artifacts to the central repository
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 7:27
Right now suppressConstructorCode doesn't work in this case:
suppressConstructorCode(A.class) when A is instantiated in the test class.
If A extends from B then it's ok to do suppressConstructorCode(B.class).
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 7:27
PowerMock should support createNiceMock and mockMethodNice
Original issue reported on code.google.com by [email protected]
on 17 Sep 2008 at 12:52
Investigate if we can check arguments to the constructor with expectNew
Original issue reported on code.google.com by [email protected]
on 13 Oct 2008 at 5:24
PowerMock must work with hamcrest. Now we get a linkage error (see
org.powermock.examples.hamcrest).
Original issue reported on code.google.com by [email protected]
on 21 Oct 2008 at 6:25
java.lang.NullPointerException
at org.powermock.Whitebox.getArgumentsAsString(Whitebox.java:529)
at org.powermock.Whitebox.throwExceptionIfMethodWasNotFound(Whitebox.java:508)
at org.powermock.Whitebox.findMethodOrThrowException(Whitebox.java:425)
at org.powermock.Whitebox.doInvokeMethod(Whitebox.java:341)
at org.powermock.Whitebox.invokeMethod(Whitebox.java:277)
Original issue reported on code.google.com by [email protected]
on 27 Oct 2008 at 1:18
The license file is not correct, it indicates BSD License but we use Apache 2.
Original issue reported on code.google.com by [email protected]
on 8 Sep 2008 at 6:56
For example the partial mocking and expect private stuff
Original issue reported on code.google.com by [email protected]
on 12 Oct 2008 at 7:47
do it!
Original issue reported on code.google.com by [email protected]
on 22 Sep 2008 at 6:03
findConstructorOrThrowException in Whitebox have two critical bugs which
effects other parts of PowerMock (for example createPartialMock).
1:
if (!paramTypes[i].equals(arguments[i].getClass())) {
wrappedConstructorFound = false;
break;
}
Solution: arguments[i].getClass() must be changed to
getUnmockedType(arguments[i].getClass())
2:
The findPrimitiveMethodOrConstructor should be renamed to
hasWrapperArguments(return value must change from true to false)
If a primitive constructor is found parameter checking must take place!!!
This doesn't happen today!!
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 9:36
For some reason it seems like the NewInvocationControl has been reverted
and doesn't support checked exceptions anymore.
NewInvocationControl should probably contain the method
public T createInstance() *throws Exception*;
Otherwise we'll run into:
java.lang.IllegalArgumentException: last method called on mock cannot throw
java.io.IOException
at org.easymock.internal.MocksControl.andThrow(MocksControl.java:110)
atse.myapp.TargetPersistenceManagerTest.testTargetConnect_failsToCreateFileName(TargetPersistenceManagerTest.java:418)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadi
e.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.in
vokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:162)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
nMethods(PowerMockJUnit44RunnerDelegateImpl.java:119)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.
run(PowerMockJUnit44RunnerDelegateImpl.java:112)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
n(PowerMockJUnit44RunnerDelegateImpl.java:110)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run
(JUnit4TestSuiteChunkerImpl.java:74)
at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.
run(AbstractCommonPowerMockRunner.java:43)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
It doesn't seem like the ExpectNewDemoTest#testNewWithCheckedException test
case tests for checked exceptions at all!!!
Original issue reported on code.google.com by [email protected]
on 1 Oct 2008 at 8:34
When doing signed mocking we change the package name from x.y.z to
powermock.x.y.z. CGLib then fails to create a mock if the class to mock is
neither public or protected. An easy solution would be to change the
visibility of all classes loaded by our classloader to public.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2008 at 9:31
Try out if it's possible to create an eclipse specific junit runner which
works on their modified(?) junit version?
Original issue reported on code.google.com by [email protected]
on 20 Oct 2008 at 8:02
To avoid cyclic dependencies we must move the WhiteBox methods used by
MockGateway to a new class. WhiteBox may delegate to this new class if needed.
Original issue reported on code.google.com by [email protected]
on 12 Oct 2008 at 7:50
powermock-full.jar contains both junit, easymock and hamcrest stuff! This
MUST be removed!!!
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 1:13
When using suppressConstructorHeirachy you should be able to do:
@PrepareForTest( SuppressConstructorHierarchyChild.class )
@RunWith(PowerMockRunner.class)
public class SuppressConstructorHierarchyDemoTest {
@Test
public void testSuppressConstructor() throws Exception {
suppressConstructorCodeHierarchy(SuppressConstructorHierarchyChild.class);
}
..
}
instead of
@PrepareForTest( { SuppressConstructorHierarchyChild.class,
SuppressConstructorHierarchyParent.class,
SuppressConstructorHeirarchyEvilGrandParent.class })
@RunWith(PowerMockRunner.class)
public class SuppressConstructorHierarchyDemoTest {
..
}
Original issue reported on code.google.com by [email protected]
on 12 Oct 2008 at 7:38
Because we're adding a defer constructor in each class this will have
implications when creating partial mocks if there's only one constructor in
the class. I.e.
tested = createPartialMock(LineSplitDataPackageWriter.class, new String[] {
""}, mDataWriterMock);
java.lang.RuntimeException: Several matching constructors found, please
specify the argument parameter types so that PowerMock can determine which
method you're refering to.
Matching constructors in class se.myapp.LineSplitDataPackageWriter were:
se.myapp.service.model.LineSplitDataPackageWriter(
org.powermock.core.classloader.annotations.internal.IndicateReloadClass.class )
se.myapp.service.model.LineSplitDataPackageWriter(
se.myapp.IDataPackageWriter.class )
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 7:26
See ExpectNewDemoDefect#testSimpleMultipleNewPrivate_tooManyTimesExpected.
Original issue reported on code.google.com by [email protected]
on 13 Sep 2008 at 11:07
You'll end up with unrooted testes.
Original issue reported on code.google.com by [email protected]
on 9 Oct 2008 at 9:22
i.e. expectNew(Log.class).andReturn(myILogMock);
Original issue reported on code.google.com by [email protected]
on 13 Oct 2008 at 5:25
Let's say you have a method like this:
private Target createTarget(ITarget target) {
Target domainTarget = null;
try {
domainTarget = new Target(getTargetName(target), target.getId());
} catch (CreationException e) {
domainTarget = new Target("Unknown", -1);
}
return domainTarget;
}
In one case here we'd like to mock the first instance creation of Target
and throw a CreationException but we'd like to make sure that a new Target
has been created with parameters "Unknown" and -1. This is not possible today.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 9:03
E.g. MyClass myClassMock = PowerMock.createPartialMock(MyClass.class, new
String[]{"loadMyClassDLL"}, null);
For ctor:
private MyClass() {
this.initialized = false;
this.connectedDUTs = new HashSet<Byte>();
}
Generates the following error:
java.lang.NullPointerException
at org.powermock.Whitebox.getArgumentsAsString(Whitebox.java:526)
at
org.powermock.Whitebox.throwExceptionIfConstructorWasNotFound(Whitebox.java:512)
at
org.powermock.Whitebox.findConstructorOrThrowException(Whitebox.java:499)
at org.powermock.PowerMock.createPartialMock(PowerMock.java:636)
at
se.ericsson.eab.sdk.jMyClasswrapper.MyClassTest.connectToDUTFail(MyClassTest.jav
a:358)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 12:56
There may be some trouble with state not being clean. It happens if the
static suppression happens after the PrivateMethodDemoTest is executed.
Original issue reported on code.google.com by [email protected]
on 26 Oct 2008 at 8:33
In some cases you want to be able to change a static final field. For
example is you need to suppress the static initializer for a class but
later need to set a final static field. We should thus remove the final
modifier from all static fields.
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 12:50
Let's say we have a class called A which extends B. Suppose B has a
protected method called "myMethod" and we wish to create a partial mock of
A where only this method is mocked. Now we need to do both
@PrepareForTest({A.class, B.class}) which is non intuitive, perhaps we
should implicitly load B with the MockClassloader when doing
@PrepareForTest(A.class)?
Original issue reported on code.google.com by [email protected]
on 29 Oct 2008 at 11:34
WhiteBox.invokeMethod(...) must throw an exception of the object passed to
the method is null (i.e. invokeMethod(null, ...)). Right now we get NPE.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 6:56
Rename to mockStaticPartialX?
Original issue reported on code.google.com by [email protected]
on 26 Oct 2008 at 7:46
Method looks like:
private Target createDomainTarget(ITarget target, boolean connecting) {
Target domainTarget = null;
try {
domainTarget = new Target(getTargetName(target, connecting),
target.getId());
} catch (MyException e) {
log.warn("Failed to get the target data from service");
domainTarget = new Target("Unknown", -1);
}
return domainTarget;
}
test looks like:
expectNew(Target.class).andThrow(new MyException("error!"));
final String getTargetNameMethodName = "getTargetName";
tested =
mockMethod(ServiceTracker.class, new String[] {
getTargetNameMethodName}, mServiceMock,
mAutoOpenDataStreamServiceMock,
mDataProviderAddedOrRemovedNotifierMock,
mTargetAddedOrRemovedNotifierMock);
final boolean connecting = true;
final String expectedTargetName = "Unknown";
final int expectedId = -1;
expectPrivate(tested, getTargetNameMethodName, mTargetMock1,
connecting).andReturn("A name");
expect(mTargetMock1.getId()).andReturn(2);
replayAll();
Target actual = (Target) Whitebox.invokeMethod(tested,
"createDomainTarget", new Class<?>[] {
ITarget.class, boolean.class}, mTargetMock1, connecting);
verifyAll();
assertEquals(expectedTargetName, actual.getName());
assertEquals(expectedId, actual.getId());
Causes error stack:
java.lang.NullPointerException
at
se.ericsson.eab.sdk.logcoordinator.service.DebugMuxServiceTrackerTest.testCreate
DomainTarget_ITarget_fails(DebugMuxServiceTrackerTest.java:545)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadi
e.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.in
vokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:162)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
nMethods(PowerMockJUnit44RunnerDelegateImpl.java:119)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.
run(PowerMockJUnit44RunnerDelegateImpl.java:112)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
n(PowerMockJUnit44RunnerDelegateImpl.java:110)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run
(JUnit4TestSuiteChunkerImpl.java:74)
at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.
run(AbstractCommonPowerMockRunner.java:43)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
The problem is that when invoking new Target(..) the exception doesn't seem
to be thrown or at least the execution is not reflected in the code, i.e.
log.warn(..) etc is never called. A new target is never created though.
Original issue reported on code.google.com by [email protected]
on 8 Sep 2008 at 7:56
Right now the doInvokeMethod catches all exceptions and wrap them in a RTE.
This is wrong. The InvokationTargetException should be caught explicitly
and the cause of this exceptions should be thrown instead. This to avoid
error stacks like this:
java.lang.RuntimeException: Failed to invoke method 'assertLogFileSet'.
Reason was: 'null'.
at org.powermock.PowerMock.doInvokeMethod(PowerMock.java:1123)
at org.powermock.PowerMock.expectVoid(PowerMock.java:723)
at
se.mayapp.TargetPersistenceManagerTest.testGetLogFileList(TargetPersistenceManag
erTest.java:454)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadi
e.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.in
vokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:162)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
nMethods(PowerMockJUnit44RunnerDelegateImpl.java:119)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.
run(PowerMockJUnit44RunnerDelegateImpl.java:112)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
n(PowerMockJUnit44RunnerDelegateImpl.java:110)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run
(JUnit4TestSuiteChunkerImpl.java:74)
at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.
run(AbstractCommonPowerMockRunner.java:43)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.powermock.PowerMock.doInvokeMethod(PowerMock.java:1121)
... 26 more
Caused by: java.lang.IllegalStateException: You need to set the log path
before using the target persistence manager.
at
se.mayapp.TargetPersistenceManager.assertLogFileSet(TargetPersistenceManager.jav
a:123)
... 31 more
I.e. the actual exception should be "java.lang.IllegalStateException: You
need to set the log path before using the target persistence manager."
Original issue reported on code.google.com by [email protected]
on 1 Oct 2008 at 11:46
We should create a "compatibility" runner for JUnit 4 and perhaps JUnit 3.
This means a Junit runner without any chunking. The chunking is tightly
coupled to internal Junit4 functionality and for custom versions of JUnit
our chunking mechanism will fail (for example in the Eclipse JUnit
version). Using a compatibility runner it would be possible to launch
PowerMock (without chunking support) with custom JUnit versions.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2008 at 11:05
In some cases you want to be able to change a static final field. For
example is you need to suppress the static initializer for a class but
later need to set a final static field. We should thus remove the final
modifier from all static fields.
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 12:51
Automatically generate all binary releases from maven. We want to have
pre-packaged jar files for powermock-junit3, powermock-junit4-legacy and
powermock-junit4. Ie project should only have to include a single powermock
jar file instead of multiple files. This will greatly simplify the use of
PowerMock for projects not using maven.
Original issue reported on code.google.com by [email protected]
on 3 Sep 2008 at 3:06
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.