Skip to content

Missing test folder in project results in plugin crash #2135

Description

@sofurihafe

Description

Test generation process doesn't start when there is no src/test folder in a project.

To Reproduce

  1. Create Java Maven project.
  2. Delete src/test directory.
  3. Enable "Mock static methods", choose "Mock everything outside the package".
  4. Pressing "Generate Tests" results in thrown exception. Internal logs are:
| UtBot - GenerateTestsDialogWindow | Tests generation instantiation phase started at 15:14:56.106
2023-04-12 15:14:56,344 [8790386]   WARN - #o.j.i.maven - doScheduleUpdateProjects: Linear Import is disabled
2023-04-12 15:14:56,488 [8790530]   WARN - #o.j.i.maven - doScheduleUpdateProjects: Linear Import is disabled
2023-04-12 15:14:56,490 [8790532] SEVERE - #c.i.i.p.PluginManager - C:\DevFolder\utbot-test-projects\2.31-master\2.2.2-master\PP_2_2_2_spring-mvc-master\src\test\resources
java.nio.file.NoSuchFileException: C:\DevFolder\utbot-test-projects\2.31-master\2.2.2-master\PP_2_2_2_spring-mvc-master\src\test\resources
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
	at java.base/java.nio.file.Files.createDirectory(Files.java:700)
	at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow.configureMockitoResources(GenerateTestsDialogWindow.kt:896)
	at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow.configureStaticMocking(GenerateTestsDialogWindow.kt:880)
	at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow.configureStaticMockingIfRequired(GenerateTestsDialogWindow.kt:833)
	at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow.doOKAction(GenerateTestsDialogWindow.kt:678)
	at com.intellij.openapi.ui.DialogWrapper$OkAction.doAction(DialogWrapper.java:1863)
	at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1817)
	at org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow$OKOptionAction.actionPerformed(GenerateTestsDialogWindow.kt:584)

Expected behavior

Generate window disappears and test generation begins.

Actual behavior

Generate window stays still and exception is thrown. Test generation doesn't begin.

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a bug

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions