[forge-dev] hasFacet return false after instalation in Forge test

Rafael Pestano rmpestano at gmail.com
Sun Feb 26 13:01:03 EST 2017

Hi guys,

I have a simple test which runs the setup command and then verifies if the
facet was installed:

public void shouldGenerateSwaggerResources() throws Exception {
    Result result = shellTest.execute("swagger-setup", 25, TimeUnit.SECONDS);
    Assert.assertThat(result, not(instanceOf(Failed.class)));
    Assert.assertThat(result.getMessage(), is(equalTo("Swagger setup
completed successfully!")));

the problem is that the assertion in returning false and test is failing.
Note that the setup command runs with success and also I can confirm the
facet is installed when I run the plugin on the IDE.

here's the setup command:


public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);

    boolean execute = true;
    if (project.hasFacet(SwaggerFacet.class) &&
project.getFacet(SwaggerFacet.class).isInstalled()) {
        execute = context.getPrompt().promptBoolean("Swagger plugin is
already installed, override it?");

    if (execute) {
        SwaggerFacet facet = facetFactory.create(project, SwaggerFacet.class);
        facetFactory.install(project, facet);
        return Results.success("Swagger setup completed successfully!");
    } else {
        return Results.success();


When I debug the test I can see the SwaggerFacet#isInstalled returns true
after setup command.

The code can be found here: https://github.com/rmpestano/swagger-addon

Any help is appreciated.


Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul

More information about the forge-dev mailing list