michalborek / mockito-eclipse-tools Goto Github PK
View Code? Open in Web Editor NEWEclipse plugin that simplifies test creation by providing refactorings for Mockito mocks.
Eclipse plugin that simplifies test creation by providing refactorings for Mockito mocks.
I always get a NullPointerException if it trigger the quickfix on a field:
java.lang.NullPointerException
at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.hasLocalFieldWithName(MocksQuickAssistProcessor.java:119)
at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.isConvertToSpyPossile(MocksQuickAssistProcessor.java:102)
at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.getAssists(MocksQuickAssistProcessor.java:43)
I am using Eclipse 4.3 and pl.greenpath.mockito.ide.refactoring_1.2.0.201403042101.jar
Mocks should not be added as first member, but the last (scope - fields)
By now unknown variables in arrays are not supported.
It should be possible to:
The "spy object" should allow user to surround object creation with spy(someObject) method.
It should be possible to annotate a field with @SPY annotation.
HTTP Server 'Bad Gateway' : http://eclipse.greenpath.pl/content.xml
HttpComponents connection error response code 502.
When converting from
test.someMethod() (when some method returns e.g. SomeObject),
into when(test.someMethod()).thenReturn(...)
the conversion should search for possible candidates to be put into thenReturn.
Some methods cannot be mocked (e.g. equals method).
In this case there should be no proposal.
[INFO] Fetching content.jar from http://download.eclipse.org/technology/m2e/releases/1.4/1.4.1.20140328-1905/ (0B of 19,77kB at 0B/s)
[INFO] Fetching content.jar from http://download.eclipse.org/technology/m2e/releases/1.4/1.4.0.20130601-0317/ (0B of 20,04kB at 0B/s)
[INFO] Adding repository http://eclipse.greenpath.pl/testing-artifacts
[ERROR] Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'testing-artifacts' from location http://eclipse.greenpath.pl/testing-artifacts: HTTP Server 'Bad Gateway' : http://eclipse.greenpath.pl/testing-artifacts/content.xml: HttpComponents connection error response code 502. -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'testing-artifacts' from location http://eclipse.greenpath.pl/testing-artifacts
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:122)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.RuntimeException: Failed to load p2 repository with ID 'testing-artifacts' from location http://eclipse.greenpath.pl/testing-artifacts
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository(TargetPlatformFactoryImpl.java:296)
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.gatherExternalInstallableUnits(TargetPlatformFactoryImpl.java:266)
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:164)
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:117)
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:1)
at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.computeTargetPlatform(P2TargetPlatformResolver.java:214)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:100)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:267)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
... 11 more
Caused by: org.eclipse.equinox.p2.core.ProvisionException: HTTP Server 'Bad Gateway' : http://eclipse.greenpath.pl/testing-artifacts/content.xml
at org.eclipse.equinox.internal.p2.repository.CacheManager.createCache(CacheManager.java:192)
at org.eclipse.tycho.p2.remote.RemoteRepositoryCacheManager.createCache(RemoteRepositoryCacheManager.java:66)
at org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory.getLocalFile(SimpleMetadataRepositoryFactory.java:66)
at org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory.load(SimpleMetadataRepositoryFactory.java:88)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad(MetadataRepositoryManager.java:57)
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:768)
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:668)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository(RemoteMetadataRepositoryManager.java:59)
at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository(RemoteMetadataRepositoryManager.java:52)
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository(TargetPlatformFactoryImpl.java:292)
... 21 more
Caused by: org.eclipse.ecf.filetransfer.BrowseFileTransferException: HttpComponents connection error response code 502.
at org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientFileSystemBrowser.runRequest(HttpClientFileSystemBrowser.java:293)
at org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser$DirectoryJob.run(AbstractFileSystemBrowser.java:69)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
Improperly converted statement:
bindingResolver.resolve(Mockito.any(AbstractTypeDeclaration.class));
becomes:
when(Mockito.any(AbstractTypeDeclaration.class)).thenReturn();
should be:
when( bindingResolver.resolve(Mockito.any(AbstractTypeDeclaration.class))).thenReturn();
There should be a proposal provided:
Result:
verify(someObj, ).someMethod();
It should be possible to convert
Object someMock = mock(Object.class);
into:
@Mock
Object someMock;
additionally it is good to have conversion from:
Object someMock = mock(Object.class, withSettings().extraInterfaces(A.class, B.class);
into:
@Mock(extraInterfaces = { A.class, B.class})
Object someMock;
Try to convert
something.equals(test).
Does not show "convert to when..."
It should be able to convert certain object to mock.
E.g.
Before: SomeClass object = new SomeClass();
after:
Either: @mock SomeClass object;
Or: SomeClass object = mock(SomeClass.class);
It a common need to add @RunWith(MockitoJunitRunner.class) annotation. There should be an easy way to do that!
Everything unusual should be logged. Now exceptional cases are printing out to the console which is not so pretty.
@Before
public void before() {
final IQuickFix fixMock1 = mock(IQuickFix.class);
testedClass = new MocksQuickFixProcessor(Arrays.asList(fixMock1, fixMock2));
}
When converting fixMock2, exception is thrown from ContextBaseTypeFinder. That's because it is treated as a method with two parameters, and the method binding returns array instead.
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.