squaretestllc / squaretest Goto Github PK
View Code? Open in Web Editor NEWTracks issues for the Squaretest plugin for IntelliJ IDEA
Home Page: https://squaretest.com
Tracks issues for the Squaretest plugin for IntelliJ IDEA
Home Page: https://squaretest.com
When I try to create a test class I get the following exception:
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'file' of com/intellij/psi/impl/PsiManagerImpl.findDirectory must not be null
at com.intellij.psi.impl.PsiManagerImpl.$$$reportNull$$$0(PsiManagerImpl.java)
at com.intellij.psi.impl.PsiManagerImpl.findDirectory(PsiManagerImpl.java)
at com.squaretest.b.e.b.a(SourceFile:77)
at com.squaretest.e.invoke(SourceFile:91)
at com.intellij.codeInsight.actions.CodeInsightAction.lambda$null$0(CodeInsightAction.java:59)
at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$1(CodeInsightAction.java:65)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:154)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:56)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformed(CodeInsightAction.java:29)
at com.squaretest.NewTestGeneratorAction.actionPerformed(SourceFile:46)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:258)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:287)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:277)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:308)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:193)
at java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:389)
at java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:357)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:355)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:343)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:767)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I think the cause is that i selected the wrong test folder. Maybe you can add a better error message for this error.
same as @Autowired
java.lang.RuntimeException: Document is locked by write PSI operations. Use PsiDocumentManager.doPostponedOperationsAndUnblockDocument() to commit PSI changes to the document.
Unprocessed elements: IMPORT_LIST(41,1184), WHITE_SPACE(0,1), WHITE_SPACE(1184,1186), WHITE_SPACE(39,41)
at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.assertDocumentChangeIsAllowed(PostprocessReformattingAspectImpl.java:334)
at com.intellij.psi.impl.PsiDocumentManagerImpl.beforeDocumentChangeOnUnlockedDocument(PsiDocumentManagerImpl.java:126)
at com.intellij.psi.impl.PsiDocumentManagerBase.beforeDocumentChange(PsiDocumentManagerBase.java:906)
at jdk.internal.reflect.GeneratedMethodAccessor226.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:118)
at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:83)
at jdk.proxy2/jdk.proxy2.$Proxy87.beforeDocumentChange(Unknown Source)
at com.intellij.openapi.editor.impl.DocumentImpl.lambda$beforeChangedUpdate$0(DocumentImpl.java:872)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:222)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:230)
at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:64)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:230)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:221)
at com.intellij.openapi.editor.impl.DocumentImpl.beforeChangedUpdate(DocumentImpl.java:869)
at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:808)
at com.intellij.openapi.editor.impl.DocumentImpl.deleteString(DocumentImpl.java:570)
at com.intellij.openapi.editor.impl.DocumentImpl$2.lambda$run$0(DocumentImpl.java:356)
at com.intellij.util.DocumentUtil.executeInBulk(DocumentUtil.java:27)
at com.intellij.openapi.editor.impl.DocumentImpl$2.run(DocumentImpl.java:351)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
at com.intellij.util.DocumentUtil.lambda$writeInRunUndoTransparentAction$0(DocumentUtil.java:47)
at com.intellij.openapi.command.impl.CoreCommandProcessor.runUndoTransparentAction(CoreCommandProcessor.java:368)
at com.intellij.util.DocumentUtil.writeInRunUndoTransparentAction(DocumentUtil.java:47)
at com.intellij.openapi.editor.impl.DocumentImpl.stripTrailingSpaces(DocumentImpl.java:348)
at com.intellij.openapi.editor.impl.TrailingSpacesStripper.strip(TrailingSpacesStripper.java:219)
at com.intellij.openapi.editor.impl.TrailingSpacesStripper.strip(TrailingSpacesStripper.java:59)
at com.intellij.openapi.editor.impl.TrailingSpacesStripper.beforeDocumentSaving(TrailingSpacesStripper.java:51)
at jdk.internal.reflect.GeneratedMethodAccessor712.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.multiCast(FileDocumentManagerImpl.java:197)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$new$0(FileDocumentManagerImpl.java:132)
at jdk.proxy2/jdk.proxy2.$Proxy23.beforeDocumentSaving(Unknown Source)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$doSaveDocumentInWriteAction$3(FileDocumentManagerImpl.java:425)
at com.intellij.pom.core.impl.PomModelImpl.guardPsiModificationsIn(PomModelImpl.java:322)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.doSaveDocumentInWriteAction(FileDocumentManagerImpl.java:424)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$doSaveDocument$2(FileDocumentManagerImpl.java:377)
at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:87)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:980)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1006)
at com.intellij.openapi.application.WriteAction.run(WriteAction.java:86)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.doSaveDocument(FileDocumentManagerImpl.java:377)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveDocument(FileDocumentManagerImpl.java:326)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveDocument(FileDocumentManagerImpl.java:315)
at com.intellij.formatting.service.AsyncDocumentFormattingService$FormattingRequestImpl.(AsyncDocumentFormattingService.java:175)
at com.intellij.formatting.service.AsyncDocumentFormattingService.formatDocument(AsyncDocumentFormattingService.java:75)
at com.intellij.formatting.service.AbstractDocumentFormattingService.formatRanges(AbstractDocumentFormattingService.java:67)
at com.intellij.formatting.service.FormattingServiceUtil.formatRanges(FormattingServiceUtil.java:93)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:147)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:112)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:105)
at com.squaretest.generation.b.e.b(SourceFile:110)
at com.squaretest.generation.b.e.a(SourceFile:99)
at com.squaretest.generation.b.e.b(SourceFile:35)
at com.squaretest.generation.b.e.a(SourceFile:29)
at com.squaretest.generation.i.d.a(SourceFile:57)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
at com.squaretest.generation.i.d.a(SourceFile:50)
at com.squaretest.generation.y.a(SourceFile:87)
at com.squaretest.i.invoke(SourceFile:133)
at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$0(CodeInsightAction.java:68)
at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$1(CodeInsightAction.java:74)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:155)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:65)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformed(CodeInsightAction.java:40)
at com.squaretest.g.actionPerformed(SourceFile:40)
at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:339)
at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:313)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:362)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:313)
at com.intellij.openapi.actionSystem.ex.ActionUtil.invokeAction(ActionUtil.java:538)
at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:261)
at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$3(ActionPopupStep.java:238)
at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1636)
at com.intellij.openapi.wm.impl.FocusManagerImpl.lambda$doWhenFocusSettlesDown$3(FocusManagerImpl.java:173)
at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:33)
at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.kt:210)
at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.kt:176)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:169)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163)
at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1634)
at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:165)
at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:397)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:293)
at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:129)
at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:161)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:262)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:250)
at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:273)
at com.intellij.ui.popup.list.ListPopupImpl.disposePopup(ListPopupImpl.java:499)
at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:526)
at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:486)
at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:432)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.handleSelect(PopupFactoryImpl.java:305)
at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:698)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385)
at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:763)
at java.desktop/java.awt.Component.processEvent(Component.java:6422)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4954)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4581)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4522)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2808)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:791)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:762)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:633)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:588)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Cant login here https://squaretest.com/#forum
Facebook error code
Login Failed: You can't use Facebook to log into this app or website because there's an issue with its implementation of Facebook Login.
I think a nice feature would be to use Mockmvc for Classes which are Annotated with @controller or @RestController.
So for examplke for a given Controller
`
@RestController
public class MyController ...
@GetMapping("/path/{pathParameter}/")
public ResponseEntity path(@RequestParam String requestParameter)..
`
generate something like
mockMvc = MockMvcBuilders.standaloneSetup(myController).build(); ... String url = format("/path/%s/",pathParameter); MvcResult mvcResult = mockMvc .perform(MockMvcRequestBuilders .get(url).param("requestParameter",requestParameter) .accept(MediaType.APPLICATION_JSON)) .andDo(print())
It would be nice to see future support for Spock tests instead of only JUnit.
This used to work without any issue. I am currently on Intellij build #UI-193.5233.102. I checked for updates and I have the latest version of Intellij IDEA and plugins installed. This worked before I got the latest updates.
Currently, it only supports java and groovy.
Is it possible to get annotations of a method?
I get the following invocation for a method which uses joda DateTime Object
when(myMock.getSomething(new DateTime(0, 0, 0, 0, 0, 0, 0))).thenReturn(0);
which leads to error
org.joda.time.IllegalFieldValueException: Value 0 for monthOfYear must be in the range [1,12]
I get the following error when writing tests in Java with some Kotlin files within the project:
java.lang.AssertionError: Language: kotlin
at com.intellij.psi.JVMElementFactories.requireFactory(JVMElementFactories.java:43)
at com.intellij.codeInsight.generation.GenerateMembersUtil.getFactory(GenerateMembersUtil.java:503)
at com.intellij.codeInsight.generation.GenerateMembersUtil.substituteGenericMethod(GenerateMembersUtil.java:266)
at com.squaretest.c.a.c.a(SourceFile:88)
at com.squaretest.c.a.b.a(SourceFile:53)
at com.squaretest.c.h.a(SourceFile:104)
at com.squaretest.completion.h.a(SourceFile:157)
at com.squaretest.completion.h.a(SourceFile:134)
at com.squaretest.completion.h.a(SourceFile:126)
at com.squaretest.completion.JavaCompletionContributor.fillCompletionVariants(SourceFile:39)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:90)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:149)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142)
at com.intellij.codeInsight.completion.JShellCompletionContributor.fillCompletionVariants(JShellCompletionContributor.java:27)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:90)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:149)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142)
at com.intellij.codeInsight.completion.JavaNoVariantsDelegator.fillCompletionVariants(JavaNoVariantsDelegator.java:56)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:90)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:149)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142)
at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:77)
at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:161)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:90)
at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:120)
at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.performCompletion(CompletionServiceImpl.java:60)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:828)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:813)
at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$null$2(CodeCompletionHandlerBase.java:280)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1166)
at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$doComplete$3(CodeCompletionHandlerBase.java:277)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:95)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
It would be useful to have a new default template, or to be able to choose which assertion library is preferred, in my case AssertJ
In case the choice is for a new default template to be added, the frameworks/librarys would be: Junit 5 + Mockito + AssertJ, I'm attaching the corresponding Velocity Template
How to modify template to mock all local reference calls
Example:
//Class to be tested
public class Foo {
public String getAccountBalance( int accountNumber ){
Account account= getAccount(accountNumber); //scenario 1 [method in same class]
Account account= Account.getAccount(accountNumber); //scenario 2 [static method in any Class]
Boo boo=new Boo();
Account account= boo.getAccount(accountNumber); //scenario 3 [method call on any other local objects]
}
}
When ever a Test method is generated for “getAccountBalance” method, I want to auto generate code to mock all 3 scenarios .
Is there a template definition that would allow one to generate tests of type
Given
When
Then
Instead of current method based simple description GWT tests is here - https://proandroiddev.com/given-when-then-style-on-android-development-using-junit5-f47388053573
Plugin generates lines like this
final UUID parameter = UUID.fromString(3fd7b159-a244-4a93-ab72-36d1eb730054);
which does not compile
5:50:13.248 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
15:50:13.273 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
15:50:13.287 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests], using SpringBootContextLoader
15:50:13.291 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests]: class path resource [com/vw/asa/ApplicationSecurityAssessmentApplicationTests-context.xml] does not exist
15:50:13.292 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests]: class path resource [com/vw/asa/ApplicationSecurityAssessmentApplicationTestsContext.groovy] does not exist
15:50:13.292 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
15:50:13.292 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.vw.asa.ApplicationSecurityAssessmentApplicationTests]: ApplicationSecurityAssessmentApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
These errors seem to come up when I try to run the test cases, what does it need?
I have a class with a couple of "Short" variables that was generated by Hibernate. I want Squaretest to generate a test class that will break if Hibernate ever generates the subject class differently. I generate a test class but it calls a constructor with literals, and, for the "Short" variable, it doesn't cast the literal, and the test class won't compile.
Example:
public class Bob {
private Short year;
}
I generate test:
public class BobTest {
private Bob bobUnderTest;
@Before
public void setUp() {
bobUnderTest = new Bob(0);
}
}
--- I'd like it to generate
public class BobTest {
private Bob bobUnderTest;
@Before
public void setUp() {
bobUnderTest = new Bob((short)0);
}
}
Currently plugin generates for every mocked methods lines like this
when(myController.myService.getEntitiesByUuidAndLong( UUID.fromString("3d0c4f7f-763f-4bed-98, 0L)).thenReturn(Arrays.asList());
I think it would be nice if it would generate a private method instead which looks like
private void givenEntitiesByUuidAndLong(Uuid uuid, Long long, List<Object> entities ){ when(myController.myService.getEntitiesByUuidAndLong .getEntitiesByUuidAndLong(uuid, long)) .thenReturn(entities); }
and add a function call in the test
givenEntitiesByUuidAndLong(UUID.fromString("3d0c4f7f-763f-4bed-98, 0L,Arrays.asList())
When creating tests with mockito squaretes generates the following imports
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
But this classes do not exist in my project. I had to correct them to
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.eq;
Not a big deal but it would be nice if plugin could detect mockito version from pom.xml or you could config mockito version somewhere so right imports are generated
Initially, tests for methods are added (any look very good). However, if a new method is added to the class under test then the Squaretest | Generate Test command just switches to the test class but does not genetate a new test as expected.
Whenever the squaretest plugin creates a new test class, it uses All argument constructors instead of no-args constructors.
The issue with this is that whenever a POJO's elements are changed, the test cases give an error for all the constructors used in all the test cases. This can be avoided with No arg constructor and using getters and setters additionally to set the values of the elements of the POJO classes.
Hello,
How can I modify the template in order to generate tests of my public static nested classes? I have looked at the template API page, but am not able to find any way to even see if these classes exist.
Thanks
According to documentation, Mockito stubs should be generated.
Maybe I am missing something?
For
public class MyController {
private final MyService myService; // MyService is an interface
public MyController(MyService myService) {
this.myService = myService;
}
public String callMyService() {
return myService.ping("hello");
}
}
this test class is generated:
class MyControllerTest {
@Mock
private MyService mockService;
private MyController myControllerUnderTest;
@BeforeEach
void setUp() {
initMocks(this);
myControllerUnderTest = new MyController(mockService);
}
@Test
void testCallMyService() {
// Setup
// Run the test
final String result = myControllerUnderTest.callMyService();
// Verify the results
assertEquals("result", result);
}
}
So something like Mockito.when(mockService.ping(Mockito.anyString())).thenReturn("anyString");
is missing.
Hi, I modified the template and if I generate a new test class, it works fine. However, if I add a new test method, it will generate with the default template, not my template.
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.