Repository: jhipster/generator-jhipster
Pull request #9266 (2019-02-14 16:25:39)

Blueprint issues
This PR contains the following fixes:
1. Fix to not check for blueprint existence when `skipChecks` is true to allow for running mocha tests in blueprints as well, even if the npm module is no linked 
2. Fix to pass `options` and `configOptions` to blueprint generators and sub-generators
3. Add mocha tests for `spring-controller` and `service-blueprints` generators

I have tested(meaning `npm test`) these changes in the generator and also with the Kotlin and VueJS blueprints

Relates to issue 1 of #9232 

-   Please make sure the below checklist is followed for Pull Requests.

-   [ ] [Travis tests](https://travis-ci.org/jhipster/generator-jhipster/pull_requests) are green
-   [x] Tests are added where necessary
-   [x] Documentation is added/updated where necessary
-   [x] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed


Patch:
diff --git a/generators/app/index.js b/generators/app/index.js
index 1fbf47f1f4..58be25d791 100644
--- a/generators/app/index.js
+++ b/generators/app/index.js
@@ -208,7 +208,7 @@ module.exports = class extends BaseGenerator {
             },
 
             validateBlueprint() {
-                if (this.blueprint) {
+                if (this.blueprint && !this.skipChecks) {
                     this.checkBlueprint(this.blueprint);
                 }
             },
@@ -346,35 +346,37 @@ module.exports = class extends BaseGenerator {
 
             composeServer() {
                 if (this.skipServer) return;
+                const options = this.options;
+                const configOptions = this.configOptions;
 
                 this.composeWith(require.resolve('../server'), {
+                    ...options,
+                    configOptions,
                     'client-hook': !this.skipClient,
-                    'from-cli': this.options['from-cli'],
-                    configOptions: this.configOptions,
-                    force: this.options.force,
                     debug: this.isDebugEnabled
                 });
             },
 
             composeClient() {
                 if (this.skipClient) return;
+                const options = this.options;
+                const configOptions = this.configOptions;
 
                 this.composeWith(require.resolve('../client'), {
-                    'skip-install': this.options['skip-install'],
-                    'skip-commit-hook': this.options['skip-commit-hook'],
-                    'from-cli': this.options['from-cli'],
-                    configOptions: this.configOptions,
-                    force: this.options.force,
+                    ...options,
+                    configOptions,
                     debug: this.isDebugEnabled
                 });
             },
 
             composeCommon() {
+                const options = this.options;
+                const configOptions = this.configOptions;
+
                 this.composeWith(require.resolve('../common'), {
+                    ...options,
                     'client-hook': !this.skipClient,
-                    'from-cli': this.options['from-cli'],
-                    configOptions: this.configOptions,
-                    force: this.options.force,
+                    configOptions,
                     debug: this.isDebugEnabled
                 });
             },
@@ -454,12 +456,14 @@ module.exports = class extends BaseGenerator {
 
             regenerateEntities() {
                 if (this.withEntities) {
+                    const options = this.options;
+                    const configOptions = this.configOptions;
                     this.getExistingEntities().forEach(entity => {
                         this.composeWith(require.resolve('../entity'), {
+                            ...options,
+                            configOptions,
                             regenerate: true,
                             'skip-install': true,
-                            'from-cli': this.options['from-cli'],
-                            force: this.options.force,
                             debug: this.isDebugEnabled,
                             arguments: [entity.name]
                         });
diff --git a/generators/client/index.js b/generators/client/index.js
index e6f3cbb47c..54ee7bb527 100644
--- a/generators/client/index.js
+++ b/generators/client/index.js
@@ -66,10 +66,8 @@ module.exports = class extends BaseBlueprintGenerator {
         // use global variable since getters dont have access to instance property
         if (!opts.fromBlueprint) {
             useBlueprint = this.composeBlueprint(blueprint, 'client', {
-                'skip-install': this.options['skip-install'],
-                'from-cli': this.options['from-cli'],
-                configOptions: this.configOptions,
-                force: this.options.force
+                ...this.options,
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/common/index.js b/generators/common/index.js
index 1f7afaf09b..e358a4e956 100644
--- a/generators/common/index.js
+++ b/generators/common/index.js
@@ -42,10 +42,9 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'common', {
+                ...this.options,
                 'client-hook': !this.skipClient,
-                'from-cli': this.options['from-cli'],
-                configOptions: this.configOptions,
-                force: this.options.force
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/entity-client/index.js b/generators/entity-client/index.js
index dc0f8390f3..6818688e1c 100644
--- a/generators/entity-client/index.js
+++ b/generators/entity-client/index.js
@@ -33,11 +33,10 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'entity-client', {
+                ...this.options,
                 context: opts.context,
-                force: opts.force,
                 debug: opts.context.isDebugEnabled,
-                'skip-install': opts.context.options['skip-install'],
-                'from-cli': opts.context.options['from-cli']
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/entity-i18n/index.js b/generators/entity-i18n/index.js
index fa080ee9ed..46161dcd9d 100644
--- a/generators/entity-i18n/index.js
+++ b/generators/entity-i18n/index.js
@@ -33,11 +33,10 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'entity-i18n', {
+                ...this.options,
                 context: opts.context,
-                force: opts.force,
                 debug: opts.context.isDebugEnabled,
-                'skip-install': opts.context.options['skip-install'],
-                'from-cli': opts.context.options['from-cli']
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/entity-server/index.js b/generators/entity-server/index.js
index 067b458938..389adfcb60 100644
--- a/generators/entity-server/index.js
+++ b/generators/entity-server/index.js
@@ -36,10 +36,10 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'entity-server', {
+                ...this.options,
                 context: opts.context,
-                force: opts.force,
                 debug: opts.context.isDebugEnabled,
-                'from-cli': opts.context.options['from-cli']
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/entity/index.js b/generators/entity/index.js
index 5686175bce..52fcd92bef 100644
--- a/generators/entity/index.js
+++ b/generators/entity/index.js
@@ -128,9 +128,8 @@ class EntityGenerator extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'entity', {
-                'skip-install': this.options['skip-install'],
-                'from-cli': this.options['from-cli'],
-                force: this.options.force,
+                ...this.options,
+                configOptions: this.configOptions,
                 arguments: [this.context.name]
             });
         } else {
@@ -1083,9 +1082,11 @@ class EntityGenerator extends BaseBlueprintGenerator {
             composeServer() {
                 const context = this.context;
                 if (context.skipServer) return;
+                const configOptions = this.configOptions;
 
                 this.composeWith(require.resolve('../entity-server'), {
                     context,
+                    configOptions,
                     force: context.options.force,
                     debug: context.isDebugEnabled
                 });
@@ -1094,9 +1095,11 @@ class EntityGenerator extends BaseBlueprintGenerator {
             composeClient() {
                 const context = this.context;
                 if (context.skipClient) return;
+                const configOptions = this.configOptions;
 
                 this.composeWith(require.resolve('../entity-client'), {
                     context,
+                    configOptions,
                     'skip-install': context.options['skip-install'],
                     force: context.options.force,
                     debug: context.isDebugEnabled
@@ -1106,9 +1109,10 @@ class EntityGenerator extends BaseBlueprintGenerator {
             composeI18n() {
                 const context = this.context;
                 if (context.skipClient) return;
-
+                const configOptions = this.configOptions;
                 this.composeWith(require.resolve('../entity-i18n'), {
                     context,
+                    configOptions,
                     'skip-install': context.options['skip-install'],
                     force: context.options.force,
                     debug: context.isDebugEnabled
diff --git a/generators/generator-base-private.js b/generators/generator-base-private.js
index 45e0267370..0aae190b78 100644
--- a/generators/generator-base-private.js
+++ b/generators/generator-base-private.js
@@ -734,7 +734,9 @@ module.exports = class extends Generator {
     composeBlueprint(blueprint, subGen, options = {}) {
         if (blueprint) {
             blueprint = this.normalizeBlueprintName(blueprint);
-            this.checkBlueprint(blueprint, subGen);
+            if (options.skipChecks === undefined || !options.skipChecks) {
+                this.checkBlueprint(blueprint, subGen);
+            }
             try {
                 const finalOptions = {
                     ...options,
diff --git a/generators/generator-base.js b/generators/generator-base.js
index 3dd1be9725..415ad5b837 100644
--- a/generators/generator-base.js
+++ b/generators/generator-base.js
@@ -1812,6 +1812,7 @@ module.exports = class extends PrivateBase {
                 'skip-server': skipServer,
                 'skip-client': skipClient,
                 'from-cli': generator.options['from-cli'],
+                skipChecks: generator.options.skipChecks,
                 languages: generator.languages,
                 force: generator.options.force,
                 debug: generator.options.debug
diff --git a/generators/languages/index.js b/generators/languages/index.js
index 7d655ca1a8..cfda5dde22 100644
--- a/generators/languages/index.js
+++ b/generators/languages/index.js
@@ -84,13 +84,9 @@ module.exports = class extends BaseBlueprintGenerator {
         // use global variable since getters dont have access to instance property
         if (!opts.fromBlueprint) {
             useBlueprint = this.composeBlueprint(blueprint, 'languages', {
-                'skip-install': this.options['skip-install'],
-                'skip-server': this.options['skip-server'],
-                'skip-client': this.options['skip-client'],
-                'from-cli': this.options['from-cli'],
+                ...this.options,
                 languages: this.languages,
                 configOptions: this.configOptions,
-                force: this.options.force,
                 arguments: this.options.languages
             });
         } else {
diff --git a/generators/server/index.js b/generators/server/index.js
index ecfae736dd..91d6476b36 100644
--- a/generators/server/index.js
+++ b/generators/server/index.js
@@ -61,10 +61,9 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'server', {
+                ...this.options,
                 'client-hook': !this.skipClient,
-                'from-cli': this.options['from-cli'],
-                configOptions: this.configOptions,
-                force: this.options.force
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/spring-controller/index.js b/generators/spring-controller/index.js
index e3904c0eed..9d1f8d6704 100644
--- a/generators/spring-controller/index.js
+++ b/generators/spring-controller/index.js
@@ -52,10 +52,9 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'spring-controller', {
-                'from-cli': this.options['from-cli'],
-                force: this.options.force,
+                ...this.options,
                 arguments: [this.name],
-                default: this.options.default
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;
diff --git a/generators/spring-service/index.js b/generators/spring-service/index.js
index e3832c6642..c600659373 100644
--- a/generators/spring-service/index.js
+++ b/generators/spring-service/index.js
@@ -48,10 +48,9 @@ module.exports = class extends BaseBlueprintGenerator {
         if (!opts.fromBlueprint) {
             // use global variable since getters dont have access to instance property
             useBlueprint = this.composeBlueprint(blueprint, 'spring-service', {
-                'from-cli': this.options['from-cli'],
-                force: this.options.force,
+                ...this.options,
                 arguments: [this.name],
-                default: this.options.default
+                configOptions: this.configOptions
             });
         } else {
             useBlueprint = false;


Test patch:
diff --git a/test/blueprint/app-blueprint.spec.js b/test/blueprint/app-blueprint.spec.js
index dab7cd025f..37c62d4211 100644
--- a/test/blueprint/app-blueprint.spec.js
+++ b/test/blueprint/app-blueprint.spec.js
@@ -2,10 +2,6 @@ const path = require('path');
 const assert = require('yeoman-assert');
 const helpers = require('yeoman-test');
 const fse = require('fs-extra');
-const CommonGenerator = require('../../generators/common');
-const ServerGenerator = require('../../generators/server');
-const ClientGenerator = require('../../generators/client');
-const createBlueprintMockForSubgen = require('../utils/utils').createBlueprintMockForSubgen;
 const expectedFiles = require('../utils/expected-files');
 const getFilesForOptions = require('../utils/utils').getFilesForOptions;
 const angularFiles = require('../../generators/client/files-angular').files;
@@ -48,12 +44,6 @@ describe('JHipster application generator with blueprint', () => {
                     nativeLanguage: 'en',
                     languages: ['fr']
                 })
-                .withGenerators([
-                    [helpers.createDummyGenerator(), 'jhipster-myblueprint:'],
-                    [createBlueprintMockForSubgen(CommonGenerator), 'jhipster-myblueprint:common'],
-                    [createBlueprintMockForSubgen(ServerGenerator), 'jhipster-myblueprint:server'],
-                    [createBlueprintMockForSubgen(ClientGenerator), 'jhipster-myblueprint:client']
-                ])
                 .on('end', done);
         });
 
diff --git a/test/blueprint/entity-blueprint.spec.js b/test/blueprint/entity-blueprint.spec.js
index 4ee04b08f3..e3333894fd 100644
--- a/test/blueprint/entity-blueprint.spec.js
+++ b/test/blueprint/entity-blueprint.spec.js
@@ -3,11 +3,7 @@ const fse = require('fs-extra');
 const assert = require('yeoman-assert');
 const helpers = require('yeoman-test');
 const expectedFiles = require('../utils/expected-files').entity;
-const createBlueprintMockForSubgen = require('../utils/utils').createBlueprintMockForSubgen;
 const EntityGenerator = require('../../generators/entity');
-const EntityClientGenerator = require('../../generators/entity-client');
-const EntityServerGenerator = require('../../generators/entity-server');
-const EntityI18nGenerator = require('../../generators/entity-i18n');
 const constants = require('../../generators/generator-constants');
 
 const CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR;
@@ -83,12 +79,7 @@ describe('JHipster entity generator with blueprint', () => {
                         blueprint: blueprintName,
                         skipChecks: true
                     })
-                    .withGenerators([
-                        [mockBlueprintSubGen, 'jhipster-myblueprint:entity'],
-                        [createBlueprintMockForSubgen(EntityClientGenerator), 'jhipster-myblueprint:entity-client'],
-                        [createBlueprintMockForSubgen(EntityServerGenerator), 'jhipster-myblueprint:entity-server'],
-                        [createBlueprintMockForSubgen(EntityI18nGenerator), 'jhipster-myblueprint:entity-i18n']
-                    ])
+                    .withGenerators([[mockBlueprintSubGen, 'jhipster-myblueprint:entity']])
                     .withPrompts({
                         fieldAdd: false,
                         relationshipAdd: false,
diff --git a/test/blueprint/spring-controller-blueprint.spec.js b/test/blueprint/spring-controller-blueprint.spec.js
new file mode 100644
index 0000000000..f0e05cff34
--- /dev/null
+++ b/test/blueprint/spring-controller-blueprint.spec.js
@@ -0,0 +1,120 @@
+const path = require('path');
+const assert = require('yeoman-assert');
+const helpers = require('yeoman-test');
+const fse = require('fs-extra');
+const SpringControllerGenerator = require('../../generators/spring-controller');
+const constants = require('../../generators/generator-constants');
+
+const SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR;
+const SERVER_TEST_SRC_DIR = constants.SERVER_TEST_SRC_DIR;
+
+const mockBlueprintSubGen = class extends SpringControllerGenerator {
+    constructor(args, opts) {
+        super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important
+        const jhContext = (this.jhipsterContext = this.options.jhipsterContext);
+        if (!jhContext) {
+            this.error("This is a JHipster blueprint and should be used only like 'jhipster --blueprint myblueprint')}");
+        }
+        this.configOptions = jhContext.configOptions || {};
+        // This sets up options for this sub generator and is being reused from JHipster
+        jhContext.setupServerOptions(this, jhContext);
+    }
+
+    get initializing() {
+        return super._initializing();
+    }
+
+    get prompting() {
+        return super._prompting();
+    }
+
+    get configuring() {
+        return super._configuring();
+    }
+
+    get default() {
+        return super._default();
+    }
+
+    get writing() {
+        const phaseFromJHipster = super._writing();
+        const customPhaseSteps = {
+            customizeName() {
+                this.name = `${this.name}Entity`;
+            }
+        };
+        return { ...customPhaseSteps, ...phaseFromJHipster };
+    }
+
+    get install() {
+        return super._install();
+    }
+
+    get end() {
+        return super._end();
+    }
+};
+
+describe('JHipster spring controller generator with blueprint', () => {
+    const blueprintNames = ['generator-jhipster-myblueprint', 'myblueprint'];
+
+    blueprintNames.forEach(blueprintName => {
+        describe(`generate spring controller with blueprint option '${blueprintName}'`, () => {
+            before(done => {
+                helpers
+                    .run(path.join(__dirname, '../../generators/spring-controller'))
+                    .withOptions({
+                        'from-cli': true,
+                        skipInstall: true,
+                        blueprint: blueprintName,
+                        skipChecks: true
+                    })
+                    .inTmpDir(dir => {
+                        fse.copySync(path.join(__dirname, '../templates/default'), dir);
+                    })
+                    .withGenerators([[mockBlueprintSubGen, 'jhipster-myblueprint:spring-controller']])
+                    .withArguments(['foo'])
+                    .withOptions({ default: true })
+                    .on('end', done);
+            });
+
+            it('creates spring controller files with different name from the default', () => {
+                assert.file([`${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/FooEntityResource.java`]);
+
+                assert.file([`${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/FooEntityResourceIT.java`]);
+            });
+
+            it('doesnt create spring controller files with default name', () => {
+                assert.noFile([`${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/FooResource.java`]);
+
+                assert.noFile([`${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/FooResourceIT.java`]);
+            });
+        });
+    });
+
+    describe('generate spring controller with dummy blueprint overriding everything', () => {
+        before(done => {
+            helpers
+                .run(path.join(__dirname, '../../generators/spring-controller'))
+                .withOptions({
+                    'from-cli': true,
+                    skipInstall: true,
+                    blueprint: 'myblueprint',
+                    skipChecks: true
+                })
+                .inTmpDir(dir => {
+                    fse.copySync(path.join(__dirname, '../templates/default'), dir);
+                })
+                .withGenerators([[mockBlueprintSubGen, 'jhipster-myblueprint:spring-controller']])
+                .withArguments(['foo'])
+                .withOptions({ default: true })
+                .on('end', done);
+        });
+
+        it("doesn't create any expected files from jhipster spring controller generator", () => {
+            assert.noFile([`${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/FooResource.java`]);
+
+            assert.noFile([`${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/FooResourceIT.java`]);
+        });
+    });
+});
diff --git a/test/blueprint/spring-service-blueprint.spec.js b/test/blueprint/spring-service-blueprint.spec.js
new file mode 100644
index 0000000000..402381dec0
--- /dev/null
+++ b/test/blueprint/spring-service-blueprint.spec.js
@@ -0,0 +1,122 @@
+const path = require('path');
+const assert = require('yeoman-assert');
+const helpers = require('yeoman-test');
+const fse = require('fs-extra');
+const SpringServiceGenerator = require('../../generators/spring-service');
+const constants = require('../../generators/generator-constants');
+
+const SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR;
+
+const mockBlueprintSubGen = class extends SpringServiceGenerator {
+    constructor(args, opts) {
+        super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important
+        const jhContext = (this.jhipsterContext = this.options.jhipsterContext);
+        if (!jhContext) {
+            this.error("This is a JHipster blueprint and should be used only like 'jhipster --blueprint myblueprint')}");
+        }
+        this.configOptions = jhContext.configOptions || {};
+        // This sets up options for this sub generator and is being reused from JHipster
+        jhContext.setupServerOptions(this, jhContext);
+    }
+
+    get initializing() {
+        return super._initializing();
+    }
+
+    get prompting() {
+        return super._prompting();
+    }
+
+    get configuring() {
+        return super._configuring();
+    }
+
+    get default() {
+        return super._default();
+    }
+
+    get writing() {
+        const phaseFromJHipster = super._writing();
+        const customPhaseSteps = {
+            customizeName() {
+                this.name = `${this.name}Entity`;
+            }
+        };
+        return { ...customPhaseSteps, ...phaseFromJHipster };
+    }
+
+    get install() {
+        return super._install();
+    }
+
+    get end() {
+        return super._end();
+    }
+};
+
+describe('JHipster spring service generator with blueprint', () => {
+    const blueprintNames = ['generator-jhipster-myblueprint', 'myblueprint'];
+
+    blueprintNames.forEach(blueprintName => {
+        describe(`generate spring service with blueprint option '${blueprintName}'`, () => {
+            before(done => {
+                helpers
+                    .run(path.join(__dirname, '../../generators/spring-service'))
+                    .withOptions({
+                        'from-cli': true,
+                        skipInstall: true,
+                        blueprint: blueprintName,
+                        skipChecks: true
+                    })
+                    .inTmpDir(dir => {
+                        fse.copySync(path.join(__dirname, '../templates/default'), dir);
+                    })
+                    .withGenerators([[mockBlueprintSubGen, 'jhipster-myblueprint:spring-service']])
+                    .withArguments(['foo'])
+                    .withPrompts({ useInterface: true })
+                    .on('end', done);
+            });
+
+            it('creates spring service files with different name from the default', () => {
+                assert.file([
+                    `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooEntityService.java`,
+                    `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/impl/FooEntityServiceImpl.java`
+                ]);
+            });
+
+            it('doesnt create spring service files with default name', () => {
+                assert.noFile([
+                    `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`,
+                    `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/impl/FooServiceImpl.java`
+                ]);
+            });
+        });
+    });
+
+    describe('generate spring service with dummy blueprint overriding everything', () => {
+        before(done => {
+            helpers
+                .run(path.join(__dirname, '../../generators/spring-service'))
+                .withOptions({
+                    'from-cli': true,
+                    skipInstall: true,
+                    blueprint: 'myblueprint',
+                    skipChecks: true
+                })
+                .inTmpDir(dir => {
+                    fse.copySync(path.join(__dirname, '../templates/default'), dir);
+                })
+                .withGenerators([[mockBlueprintSubGen, 'jhipster-myblueprint:spring-service']])
+                .withArguments(['foo'])
+                .withPrompts({ useInterface: true })
+                .on('end', done);
+        });
+
+        it("doesn't create any expected files from jhipster spring service generator", () => {
+            assert.noFile([
+                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`,
+                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/impl/FooServiceImpl.java`
+            ]);
+        });
+    });
+});
diff --git a/test/utils/utils.js b/test/utils/utils.js
index 8166c30b64..9c41acb172 100644
--- a/test/utils/utils.js
+++ b/test/utils/utils.js
@@ -11,7 +11,6 @@ module.exports = {
     getFilesForOptions,
     shouldBeV3DockerfileCompatible,
     getJHipsterCli,
-    createBlueprintMockForSubgen,
     testInTempDir
 };
 
@@ -61,44 +60,3 @@ function testInTempDir(cb) {
     /* eslint-disable-next-line no-console */
     console.log(`current cwd: ${process.cwd()}`);
 }
-
-function createBlueprintMockForSubgen(parentSubGenerator) {
-    return class extends parentSubGenerator {
-        constructor(args, opts) {
-            super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important
-            const jhContext = (this.jhipsterContext = this.options.jhipsterContext);
-            if (!jhContext) {
-                this.error("This is a JHipster blueprint and should be used only like 'jhipster --blueprint ...')}");
-            }
-            this.configOptions = jhContext.configOptions || {};
-        }
-
-        get initializing() {
-            return super._initializing();
-        }
-
-        get prompting() {
-            return super._prompting();
-        }
-
-        get configuring() {
-            return super._configuring();
-        }
-
-        get default() {
-            return super._default();
-        }
-
-        get writing() {
-            return super._writing();
-        }
-
-        get install() {
-            return super._install();
-        }
-
-        get end() {
-            return super._end();
-        }
-    };
-}