Hi guys.
I'm facing a problem when testing an addon setup command, here is some code:
@Test
public void testSwaggerSetup() throws Exception {
//facetFactory.install(project, SwaggerFacet.class);
try (CommandController controller =
uiTestHarness.createCommandController(SwaggerSetupCommand.class,
project.getRoot())) {
controller.initialize();
Assert.assertTrue(controller.isValid());
final AtomicBoolean flag = new AtomicBoolean();
controller.getContext().addCommandExecutionListener(new
AbstractCommandExecutionListener() {
@Override
public void postCommandExecuted(UICommand command,
UIExecutionContext context, Result result) {
if (result.getMessage().equals("Swagger setup
completed successfully!")) {
flag.set(true);
}
}
});
controller.execute();
Assert.assertTrue(flag.get());
SwaggerFacet facet = project.getFacet(SwaggerFacet.class);
Assert.assertTrue(facet.isInstalled());
I receive 'No Facet of type [interface
com.tdc.addon.swagger.facet.SwaggerFacet] is installed.
org.jboss.forge.addon.facets.FacetNotFoundException'" when i try to get
facet:
project.getFacet(SwaggerFacet.class);
if I uncomment "facetFactory.install(project, SwaggerFacet.class);" the
test passes.
I've debuged setup command and the facet is installed (temp project pom is
updated after setup) and 'flag.get()' returns true.
Any hints?
souces are here:
https://github.com/rmpestano/swagger-addon/blob/master/src/test/java/com/...
<
https://github.com/rmpestano/swagger-addon/blob/master/src/test/java/com/...
thanks in advance.
--
<
http://www.advancedit.com.br/>Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano <
https://twitter.com/realpestano>