Skip to content

Correct Parametrized tests checkbox functioning #933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alisevych opened this issue Sep 15, 2022 · 0 comments · Fixed by #938
Closed

Correct Parametrized tests checkbox functioning #933

alisevych opened this issue Sep 15, 2022 · 0 comments · Fixed by #938
Assignees
Labels
comp-ui Improvements of plugin UI appearence and functionality ctg-bug Issue is a bug status-verified Bug fix is verified

Comments

@alisevych
Copy link
Member

alisevych commented Sep 15, 2022

Description

Parametrized tests is checkbox is connected with Mock strategy and Mock static methods fields.

  • Possibility to select them together should be forbidden.
  • Now when they are turned on together java.lang.ClassCastExceptionis thrown in IDEA.
  • After that Mock strategy and Mock static methods fields are disabled with checked/unchecked Parametrization checkbox.

To Reproduce

  1. IntelliJ IDEA 2022.1.4 is opened with the latest UTBot plugin installed from main
    with merged: Improve settings, part 1 #898
  2. Open/clone UTBotJava project
  3. Generate tests for utbot-sample/src/main/java/org/utbot/examples/ternary/Ternary.java
    with the following settings:
    Parametrized tests - on
    Mock strategy - Mock package environment
  4. Wait for tests to be generated
  5. Open UTBot dialog once again - for any class
  6. Check / uncheck Parametrized tests checkbox

Expected behavior

  1. When Parametrized is checked - Mock strategy should become "Do not mock" and Mock static methods should be unchecked - and both Mock controls should be disabled.
  2. No exception should be thrown in IDE.
  3. It should be possible to change Mock strategy and Mock static methods controls.

Actual behavior

  1. Parametrized tests and some Mock strategy are available to select together in one generation.

image

java.lang.ClassCastException is thrown java.lang.ClassCastException: class javax.swing.JCheckBox cannot be cast to class com.intellij.openapi.ui.ComboBox (javax.swing.JCheckBox is in module java.desktop of loader 'bootstrap'; com.intellij.openapi.ui.ComboBox is in unnamed module of loader com.intellij.util.lang.PathClassLoader @224aed64) at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow$setListeners$5.actionPerformed(GenerateTestsDialogWindow.kt:904) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:401) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6654) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345) at java.desktop/java.awt.Component.processEvent(Component.java:6419) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5029) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2793) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484) 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.pumpEventsForFilter(EventDispatchThread.java:121) at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233) at java.desktop/java.awt.Dialog.show(Dialog.java:1070) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:702) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:439) at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1668) at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1626) at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1640) at org.utbot.intellij.plugin.generator.UtTestsDialogProcessor.createDialogAndGenerateTests(UtTestsDialogProcessor.kt:78) at org.utbot.intellij.plugin.ui.actions.GenerateTestsAction.actionPerformed(GenerateTestsAction.kt:33) at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:65) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:579) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:704) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$11(IdeKeyEventDispatcher.java:704) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:256) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:701) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:645) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:590) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:473) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:462) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:227) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:804) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:740) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484) 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)
  1. Mock strategy and Mock static methods controls are disabled now.
    No matter is Parametrized tests selected or not.

Visual proofs (screenshots, logs, images)

image

image

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.4
JDK 11

Additional context

If you generate tests again with parametrized OFF - the Mock related fields will be enabled on next dialog opening again.

@alisevych alisevych added the ctg-bug Issue is a bug label Sep 15, 2022
@korifey korifey moved this to Todo in UTBot Java Sep 15, 2022
@alisevych alisevych added the comp-ui Improvements of plugin UI appearence and functionality label Sep 15, 2022
@alisevych alisevych changed the title Mock related fields are disabled when previously parametrized tests were generated Mock related fields are disabled after parametrized tests were generated Sep 15, 2022
@alisevych alisevych added this to the Release preparation milestone Sep 15, 2022
@alisevych alisevych changed the title Mock related fields are disabled after parametrized tests were generated Correct Parametrized tests checkbox functioning Sep 15, 2022
@Vassiliy-Kudryashov Vassiliy-Kudryashov moved this from Todo to In Progress in UTBot Java Sep 15, 2022
@Vassiliy-Kudryashov Vassiliy-Kudryashov linked a pull request Sep 15, 2022 that will close this issue
3 tasks
Vassiliy-Kudryashov added a commit that referenced this issue Sep 15, 2022
Repository owner moved this from In Progress to Done in UTBot Java Sep 15, 2022
@alisevych alisevych added the status-verified Bug fix is verified label Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-ui Improvements of plugin UI appearence and functionality ctg-bug Issue is a bug status-verified Bug fix is verified
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants