diff --git a/extensions/intellij/intellij_generator_plugin/build.gradle b/extensions/intellij/intellij_generator_plugin/build.gradle
index 8a05a6a1d..93ad74ef6 100644
--- a/extensions/intellij/intellij_generator_plugin/build.gradle
+++ b/extensions/intellij/intellij_generator_plugin/build.gradle
@@ -8,7 +8,7 @@ plugins {
}
group 'com.rx_bloc'
-version '3.0.4'
+version '3.1.0'
apply plugin: 'org.jetbrains.intellij'
@@ -55,6 +55,9 @@ patchPluginXml {
changeNotes """
-
+ v.3.1.0 - Added the option to choose between the `golden_toolkit` and `alchemist` packages when creating golden tests.
+
+ -
v.3.0.4 - Replaced deprecated classes from external libraries with their updated counterparts to ensure compatibility and improve performance
-
@@ -90,7 +93,7 @@ patchPluginXml {
- v1.5.0
- Updated DI Dependencies to not be a singleton
- Added an improvement to the - Wrap With Quick Action Support -
- to analyze, filter and display a choose BloC states dialog - based on the file names and path - by the convension:
+ to analyze, filter and display a choose BloC states dialog - based on the file names and path - by the convention:
feature_xx
-- bloc / xx_bloc.dart
-- di
@@ -104,8 +107,8 @@ patchPluginXml {
- Introduce "New -> RxBloc List".
- Wrap With Quick Action Support (RxBlocBuilder, RxResultBuilder, RxPaginatedBuilder, RxBlocListener, RxFormFieldBuilder, RxTextFormFieldBuilder).
- - v1.3.0 - Added option for creating an entire feature that includes bloc, page and dependency inhection
- - v1.2.0 - Added option for creating Null Safety BloC claseses
+ - v1.3.0 - Added option for creating an entire feature that includes bloc, page and dependency injection
+ - v1.2.0 - Added option for creating Null Safety BloC classes
- v1.1.0 - Added option for creating BloC extensions
- v1.0.0 - Initial release
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapSingleTestAction.kt b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapSingleTestAction.kt
index 05b8646dd..1048c1cb9 100755
--- a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapSingleTestAction.kt
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapSingleTestAction.kt
@@ -12,15 +12,17 @@ import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile
+import com.primeholding.rxbloc_generator_plugin.action.GenerateRxBlocTestDialog.TestLibrary
import com.primeholding.rxbloc_generator_plugin.generator.RxTestGeneratorBase
import com.primeholding.rxbloc_generator_plugin.generator.parser.Utils
import com.primeholding.rxbloc_generator_plugin.intention_action.BlocWrapWithIntentionAction
import java.io.File
-class BootstrapSingleTestAction : AnAction() {
+class BootstrapSingleTestAction : AnAction(), GenerateRxBlocTestDialog.Listener {
private var project: Project? = null
+ private var selectedFile: VirtualFile? = null
override fun update(e: AnActionEvent?) {
super.update(e)
@@ -68,30 +70,32 @@ class BootstrapSingleTestAction : AnAction() {
var file: VirtualFile?
- if (e != null) {
- WriteCommandAction.runWriteCommandAction(e.project!!) {
+ if (project != null) {
+ WriteCommandAction.runWriteCommandAction(project) {
CommandProcessor.getInstance().executeCommand(
- e.project!!, {
+ project, {
for (i in 0..files?.size!!) {
file = files[i]
if (!file!!.isDirectory) {
if (isBlocFile(file)) {
- generateBloc(file!!, e.project!!)
+ generateBloc(file!!, project!!)
break
}
if (isServiceFile(file)) {
- generateService(file!!, e.project!!)
+ generateService(file!!, project!!)
break
}
if (isRepositoryFile(file)) {
- generateRepository(file!!, e.project!!)
+ generateRepository(file!!, project!!)
break
}
if (isUIFile(file)) {
- generateGoldenTest(file!!, e.project!!)
+ selectedFile = file
+ val dialog = GenerateRxBlocTestDialog(this)
+ dialog.show()
break
}
}
@@ -125,6 +129,12 @@ class BootstrapSingleTestAction : AnAction() {
return false
}
+ override fun onGenerateBlocTestClicked(selectedTestLibrary: TestLibrary) {
+ if(selectedFile != null) {
+ generateGoldenTest(selectedFile!!, project!!, selectedTestLibrary)
+ }
+ }
+
private fun projectLibFolder(): String = "${project?.name}${File.separator}lib"
private fun projectLibAbsolutePath(): String = "${project?.basePath}${File.separator}lib"
private fun projectTestFolder(): String = "${project?.name}${File.separator}test"
@@ -329,15 +339,9 @@ class BootstrapSingleTestAction : AnAction() {
}
- val newFile = Utils.baseDir(project.basePath!!);
+ val newFile = Utils.baseDir(project.basePath!!)
FileUtil.createIfDoesntExist(File(newFilePath))
-
-// val newFile = VfsTestUtil.createFile(
-// Utils.baseDir(project.basePath!!),
-// newFilePath
-// )
-
BootstrapTestsAction.writeBlockTest(
newFile,
bloc,
@@ -348,7 +352,7 @@ class BootstrapSingleTestAction : AnAction() {
}
}
- private fun generateGoldenTest(file: VirtualFile, project: Project) {
+ private fun generateGoldenTest(file: VirtualFile, project: Project, selectedTestLibrary: TestLibrary) {
val constructorFields: MutableMap = mutableMapOf()
val constructorNamedFields: MutableMap = mutableMapOf()
val goldenFile = File(file.path)
@@ -417,36 +421,9 @@ Scaffold(
}
sb = StringBuffer()
- sb.append(
- """
-import 'package:flutter_test/flutter_test.dart';
+ val goldenFileContent = (if (selectedTestLibrary == TestLibrary.GoldenToolkit) createGoldenToolkitFileContent(blocFieldCase, blocSnakeCase) else createAlchemistGoldenFileContent(blocFieldCase, blocSnakeCase))
-import '../../helpers/golden_helper.dart';
-import '../../helpers/models/scenario.dart';
-import '${blocSnakeCase}_factory.dart';
-import 'package:rx_bloc/rx_bloc.dart';
-import 'package:rx_bloc_list/models.dart';
-
-
-void main () {
- runGoldenTests(
- [
- generateDeviceBuilder(
- widget: ${blocFieldCase}Factory(), //example: Stubs.emptyList
- scenario: Scenario(name: '${blocSnakeCase}_empty')),
- generateDeviceBuilder(
- widget: ${blocFieldCase}Factory(), //example: Stubs.success
- scenario: Scenario(name: '${blocSnakeCase}_success')),
- generateDeviceBuilder(
- widget: ${blocFieldCase}Factory(), //loading
- scenario: Scenario(name: '${blocSnakeCase}_loading')),
- generateDeviceBuilder(
- widget: ${blocFieldCase}Factory(),
- scenario: Scenario(name: '${blocSnakeCase}_error'))
- ]);
- }
-""".trimIndent()
- )
+ sb.append(goldenFileContent)
newFile = createFile(file, "_golden_test.dart", sb.toString())
if (newFile != null) {
@@ -466,4 +443,60 @@ void main () {
}
return sb.toString()
}
+
+
+ private fun createGoldenToolkitFileContent(blocFieldCase: String, blocSnakeCase: String): String =
+ """
+import '../../helpers/golden_helper.dart';
+import '../../helpers/models/scenario.dart';
+import '${blocSnakeCase}_factory.dart';
+
+
+void main () {
+ runGoldenTests(
+ [
+ generateDeviceBuilder(
+ widget: ${blocFieldCase}Factory(), //example: Stubs.emptyList
+ scenario: Scenario(name: '${blocSnakeCase}_empty')),
+ generateDeviceBuilder(
+ widget: ${blocFieldCase}Factory(), //example: Stubs.success
+ scenario: Scenario(name: '${blocSnakeCase}_success')),
+ generateDeviceBuilder(
+ widget: ${blocFieldCase}Factory(), //loading
+ scenario: Scenario(name: '${blocSnakeCase}_loading')),
+ generateDeviceBuilder(
+ widget: ${blocFieldCase}Factory(),
+ scenario: Scenario(name: '${blocSnakeCase}_error'))
+ ]);
+}
+""".trimIndent()
+
+ private fun createAlchemistGoldenFileContent(blocFieldCase: String, blocSnakeCase: String): String =
+ """
+import '../../helpers/golden_helper.dart';
+import '${blocSnakeCase}_factory.dart';
+
+
+void main () {
+ runGoldenTests(
+ [
+ buildScenario(
+ scenario: '${blocSnakeCase}_empty',
+ widget: ${blocFieldCase}Factory(),
+ ),
+ buildScenario(
+ scenario: '${blocSnakeCase}_success',
+ widget: ${blocFieldCase}Factory(),
+ ),
+ buildScenario(
+ scenario: '${blocSnakeCase}_loading',
+ widget: ${blocFieldCase}Factory(),
+ ),
+ buildScenario(
+ scenario: '${blocSnakeCase}_error',
+ widget: ${blocFieldCase}Factory(),
+ ),
+ ]);
+}
+""".trimIndent()
}
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapTestsAction.kt b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapTestsAction.kt
index 786cbd86c..0fc6af642 100755
--- a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapTestsAction.kt
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/BootstrapTestsAction.kt
@@ -9,13 +9,27 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.VirtualFile
+import com.primeholding.rxbloc_generator_plugin.action.GenerateRxBlocTestDialog.TestLibrary
import com.primeholding.rxbloc_generator_plugin.generator.parser.TestableClass
import com.primeholding.rxbloc_generator_plugin.generator.parser.Utils
import com.primeholding.rxbloc_generator_plugin.ui.ChooseBlocsDialog
import java.io.File
-class BootstrapTestsAction : AnAction() {
+class BootstrapTestsAction : AnAction(), GenerateRxBlocTestDialog.Listener {
+
+ private lateinit var event: AnActionEvent
+
+ override fun actionPerformed(e: AnActionEvent) {
+ event = e
+ val dialog = GenerateRxBlocTestDialog(this)
+ dialog.show()
+ }
+
+ override fun onGenerateBlocTestClicked(selectedTestLibrary: TestLibrary) {
+ generate(selectedTestLibrary)
+ }
+
override fun update(e: AnActionEvent?) {
super.update(e)
val files = e?.dataContext?.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)
@@ -66,21 +80,17 @@ class BootstrapTestsAction : AnAction() {
return false
}
- private fun isChooseBlogsDialog(file: VirtualFile): Boolean {
- if (file.isDirectory && (file.name == "lib" || file.name == "src" || file.name == "test")) {
- return true
- }
- return false
- }
+ private fun isChooseBlogsDialog(file: VirtualFile): Boolean =
+ file.isDirectory && (file.name == "lib" || file.name == "src" || file.name == "test")
- override fun actionPerformed(e: AnActionEvent?) {
+ private fun generate(selectedTestLibrary: TestLibrary) {
val allowedPrefixes = listOf("feature_", "lib_")
- e?.project?.basePath?.let { baseDir ->
+ event.project?.basePath?.let { baseDir ->
var isShowDialog = false
- val files = e.dataContext.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)
+ val files = event.dataContext.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)
val potentialBlocFolders = mutableListOf()
@@ -118,7 +128,7 @@ class BootstrapTestsAction : AnAction() {
val dialog = ChooseBlocsDialog(parsedLib, selected)
val showAndGet = dialog.showAndGet()
if (showAndGet) {
- writeItIntoTests(test, selected, trueBaseDir.name, e.project!!, dialog.includeDiMocks())
+ writeItIntoTests(test, selected, trueBaseDir.name, event.project!!, dialog.includeDiMocks(), selectedTestLibrary)
}
}
} else {
@@ -129,13 +139,13 @@ class BootstrapTestsAction : AnAction() {
}
if (list.isEmpty()) {
Messages.showMessageDialog(
- "No BloCs Found in the selected direcoty that follow naming convention",
+ "No BloCs Found in the selected directory that follow naming convention",
"No Blocs",
null
)
return
}
- writeItIntoTests(test, list, trueBaseDir.name, e.project!!, true)//potentially choose the flag
+ writeItIntoTests(test, list, trueBaseDir.name, event.project!!, true, selectedTestLibrary)//potentially choose the flag
}
}
}
@@ -145,7 +155,8 @@ class BootstrapTestsAction : AnAction() {
blocs: List,
projectName: String,
project: Project,
- includeDiMocks: Boolean
+ includeDiMocks: Boolean,
+ selectedTestLibrary: TestLibrary
) {
val blocFileExt = "_bloc.dart"
WriteCommandAction.runWriteCommandAction(project) {
@@ -188,7 +199,8 @@ class BootstrapTestsAction : AnAction() {
folder = featureFolder.createChildDirectory(this, "view")
testFile = folder.createChildData(this, bloc.file.name.replace(blocFileExt, "_golden_test.dart"))
- writeGoldenTest(testFile, bloc, projectName)
+ val goldenTemplateName = (if (selectedTestLibrary == TestLibrary.GoldenToolkit) "bloc_golden" else "bloc_alchemist_golden")
+ writeGoldenTest(testFile, bloc, projectName, goldenTemplateName)
FileEditorManager.getInstance(project).openFile(testFile, true)
@@ -211,9 +223,12 @@ class BootstrapTestsAction : AnAction() {
companion object {
- fun writeGoldenTest(testFile: VirtualFile, bloc: TestableClass, projectName: String) {
+ fun writeGoldenTest(testFile: VirtualFile, bloc: TestableClass, projectName: String, templateName: String) {
val test = com.primeholding.rxbloc_generator_plugin.generator.components.RxTestBlocGoldenGenerator(
- name = bloc.file.name.replace(".dart", ""), projectName = projectName, bloc = bloc
+ name = bloc.file.name.replace(".dart", ""),
+ templateName = templateName,
+ projectName = projectName,
+ bloc = bloc
)
FileUtil.writeToFile(File(testFile.path), test.generate())
}
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.form b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.form
new file mode 100644
index 000000000..157933e42
--- /dev/null
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.form
@@ -0,0 +1,32 @@
+
+
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.java b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.java
new file mode 100644
index 000000000..c663af5de
--- /dev/null
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/action/GenerateRxBlocTestDialog.java
@@ -0,0 +1,43 @@
+package com.primeholding.rxbloc_generator_plugin.action;
+
+import com.intellij.openapi.ui.DialogWrapper;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class GenerateRxBlocTestDialog extends DialogWrapper {
+
+ private final Listener listener;
+ private JPanel contentPane;
+ private JComboBox testLibrarySelection;
+
+ public GenerateRxBlocTestDialog(final Listener listener) {
+ super(null);
+ this.listener = listener;
+ init();
+ }
+
+ @Nullable
+ @Override
+ protected JComponent createCenterPanel() {
+ return contentPane;
+ }
+
+ @Override
+ protected void doOKAction() {
+ super.doOKAction();
+ this.listener.onGenerateBlocTestClicked(
+ GenerateRxBlocTestDialog.TestLibrary.values()[testLibrarySelection.getSelectedIndex()]
+ );
+ }
+
+ public enum TestLibrary {
+ Alchemist, GoldenToolkit
+ }
+
+ public interface Listener {
+ void onGenerateBlocTestClicked(
+ GenerateRxBlocTestDialog.TestLibrary selectedTestLibrary
+ );
+ }
+}
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGenerator.kt b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGenerator.kt
index 82a96a81f..4afc39873 100755
--- a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGenerator.kt
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGenerator.kt
@@ -3,8 +3,8 @@ package com.primeholding.rxbloc_generator_plugin.generator.components
import com.primeholding.rxbloc_generator_plugin.generator.RxTestGeneratorBase
import com.primeholding.rxbloc_generator_plugin.generator.parser.TestableClass
-class RxTestBlocGoldenGenerator(val name: String, projectName: String, bloc: TestableClass) :
-RxTestGeneratorBase(name, templateName = "bloc_golden", projectName = projectName, bloc = bloc) {
+class RxTestBlocGoldenGenerator(val name: String, val templateName: String, projectName: String, bloc: TestableClass) :
+RxTestGeneratorBase(name, templateName = templateName, projectName = projectName, bloc = bloc) {
override fun fileName() = "${snakeCase()}_golden_test.${fileExtension()}"
override fun contextDirectoryName(): String = "view"
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/parser/Utils.kt b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/parser/Utils.kt
index ddb316469..adfc775a4 100755
--- a/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/parser/Utils.kt
+++ b/extensions/intellij/intellij_generator_plugin/src/main/java/com/primeholding/rxbloc_generator_plugin/generator/parser/Utils.kt
@@ -98,7 +98,7 @@ class Utils {
private fun removeNonFinalOrEmptyFields(constructorFields: MutableMap) {
val keysSet = ArrayList(constructorFields.keys)
keysSet.forEach {
- if (constructorFields[it]!!.isEmpty()) {
+ if (constructorFields[it].isNullOrEmpty()) {
constructorFields.remove(it)
}
}
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_alchemist_golden.dart.template b/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_alchemist_golden.dart.template
new file mode 100644
index 000000000..6fe1b9c84
--- /dev/null
+++ b/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_alchemist_golden.dart.template
@@ -0,0 +1,24 @@
+import '../../helpers/golden_helper.dart';
+import '../factory/${bloc_snake_case}_factory.dart';
+
+
+void main() {
+ runGoldenTests([
+ buildScenario(
+ scenario: '${bloc_snake_case}_empty',
+ widget: ${bloc_field_case}Factory(),
+ ),
+ buildScenario(
+ scenario: '${bloc_snake_case}_success',
+ widget: ${bloc_field_case}Factory(),
+ ),
+ buildScenario(
+ scenario: '${bloc_snake_case}_loading',
+ widget: ${bloc_field_case}Factory(),
+ ),
+ buildScenario(
+ scenario: '${bloc_snake_case}_error',
+ widget: ${bloc_field_case}Factory(),
+ ),
+ ]);
+}
\ No newline at end of file
diff --git a/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_golden.dart.template b/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_golden.dart.template
index 7d58a0fa0..82db5c41a 100644
--- a/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_golden.dart.template
+++ b/extensions/intellij/intellij_generator_plugin/src/main/resources/templates/rx_bloc_tests/bloc_golden.dart.template
@@ -1,10 +1,6 @@
-import 'package:flutter_test/flutter_test.dart';
-
import '../../helpers/golden_helper.dart';
import '../../helpers/models/scenario.dart';
import '../factory/${bloc_snake_case}_factory.dart';
-import 'package:rx_bloc/rx_bloc.dart';
-import 'package:rx_bloc_list/models.dart';
void main() {
diff --git a/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocFactoryGeneratorTest.java b/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocFactoryGeneratorTest.java
index b9b51a349..7363dc825 100644
--- a/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocFactoryGeneratorTest.java
+++ b/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocFactoryGeneratorTest.java
@@ -1,6 +1,5 @@
package com.primeholding.rxbloc_generator_plugin.generator.components;
-import com.primeholding.rxbloc_generator_plugin.generator.parser.TestableClass;
import org.junit.Test;
import java.io.File;
diff --git a/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGeneratorTest.java b/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGeneratorTest.java
index 34d2ef6c0..6872a8243 100644
--- a/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGeneratorTest.java
+++ b/extensions/intellij/intellij_generator_plugin/src/test/java/com/primeholding/rxbloc_generator_plugin/generator/components/RxTestBlocGoldenGeneratorTest.java
@@ -12,12 +12,19 @@ public class RxTestBlocGoldenGeneratorTest extends BaseTestGenerator {
@Test
public void testBlocWithAll() throws IOException {
- RxTestBlocGoldenGenerator rxBlocGenerator = new RxTestBlocGoldenGenerator(blockName(), projectName(), getWithAllBloc());
+ RxTestBlocGoldenGenerator rxBlocGenerator = new RxTestBlocGoldenGenerator(blockName(), "bloc_golden", projectName(), getWithAllBloc());
String generate = rxBlocGenerator.generate().trim();
File file = new File("src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocGoldenGenerator_all.dart");
String inputRepoText = String.join("\n", Files.readAllLines(file.toPath())).trim();
assertEquals(generate, inputRepoText);
}
-
-}
+ @Test
+ public void testBlocAlchemistWithAll() throws IOException {
+ RxTestBlocGoldenGenerator rxBlocGenerator = new RxTestBlocGoldenGenerator(blockName(), "bloc_alchemist_golden", projectName(), getWithAllBloc());
+ String generate = rxBlocGenerator.generate().trim();
+ File file = new File("src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocAlchemistGoldenGenerator_all.dart");
+ String inputRepoText = String.join("\n", Files.readAllLines(file.toPath())).trim();
+ assertEquals(generate, inputRepoText);
+ }
+}
\ No newline at end of file
diff --git a/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxGeneratedBlocListGenerator/sample_list_bloc.rxb.g.dart b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxGeneratedBlocListGenerator/sample_list_bloc.rxb.g.dart
new file mode 100644
index 000000000..ad44e4baf
--- /dev/null
+++ b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxGeneratedBlocListGenerator/sample_list_bloc.rxb.g.dart
@@ -0,0 +1,68 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+// **************************************************************************
+// Generator: RxBlocGeneratorForAnnotation
+// **************************************************************************
+
+part of 'profile_list_bloc.dart';
+
+/// Used as a contractor for the bloc, events and states classes
+/// {@nodoc}
+abstract class ProfileListBlocType extends RxBlocTypeBase {
+ /// Events of the bloc
+ ProfileListBlocEvents get events;
+
+ /// States of the bloc
+ ProfileListBlocStates get states;
+}
+
+/// [$ProfileList] extended by the [ProfileList]
+/// {@nodoc}
+abstract class $ProfileListBloc extends RxBlocBase
+ implements ProfileListBlocEvents, ProfileListBlocStates, ProfileListBlocType {
+ final _compositeSubscription = CompositeSubscription();
+
+ /// Тhe [Subject] where events sink to by calling [loadPage]
+ final _$loadPageEvent = PublishSubject();
+
+ /// The state of [isLoading] implemented in [_mapToIsLoadingState]
+ late final Stream _isLoadingState = _mapToIsLoadingState();
+
+ /// The state of [errors] implemented in [_mapToErrorsState]
+ late final Stream _errorsState = _mapToErrorsState();
+
+ /// The state of [paginatedList] implemented in [_mapToPaginatedListState]
+ late final Stream> _paginatedListState =
+ _mapToPaginatedListState();
+
+ @override
+ void loadPage({bool reset = false}) => _$loadPageEvent.add(reset);
+
+ @override
+ Stream get isLoading => _isLoadingState;
+
+ @override
+ Stream get errors => _errorsState;
+
+ @override
+ Stream> get paginatedList => _paginatedListState;
+
+ Stream _mapToIsLoadingState();
+
+ Stream _mapToErrorsState();
+
+ Stream> _mapToPaginatedListState();
+
+ @override
+ ProfileListBlocEvents get events => this;
+
+ @override
+ ProfileListBlocStates get states => this;
+
+ @override
+ void dispose() {
+ _$loadPageEvent.close();
+ _compositeSubscription.dispose();
+ super.dispose();
+ }
+}
\ No newline at end of file
diff --git a/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocAlchemistGoldenGenerator_all.dart b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocAlchemistGoldenGenerator_all.dart
new file mode 100644
index 000000000..9377f5872
--- /dev/null
+++ b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocAlchemistGoldenGenerator_all.dart
@@ -0,0 +1,24 @@
+import '../../helpers/golden_helper.dart';
+import '../factory/sample_factory.dart';
+
+
+void main() {
+ runGoldenTests([
+ buildScenario(
+ scenario: 'sample_empty',
+ widget: sampleFactory(),
+ ),
+ buildScenario(
+ scenario: 'sample_success',
+ widget: sampleFactory(),
+ ),
+ buildScenario(
+ scenario: 'sample_loading',
+ widget: sampleFactory(),
+ ),
+ buildScenario(
+ scenario: 'sample_error',
+ widget: sampleFactory(),
+ ),
+ ]);
+}
\ No newline at end of file
diff --git a/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocGoldenGenerator_all.dart b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocGoldenGenerator_all.dart
index 69d360d4f..da0a255af 100644
--- a/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocGoldenGenerator_all.dart
+++ b/extensions/intellij/intellij_generator_plugin/src/test/resources/generator/RxTestBlocGoldenGenerator/RxTestBlocGoldenGenerator_all.dart
@@ -1,10 +1,6 @@
-import 'package:flutter_test/flutter_test.dart';
-
import '../../helpers/golden_helper.dart';
import '../../helpers/models/scenario.dart';
import '../factory/sample_factory.dart';
-import 'package:rx_bloc/rx_bloc.dart';
-import 'package:rx_bloc_list/models.dart';
void main() {