Search code examples
javaopenrewrite

Openrewrite Recipe not being executed during Test


Continuing on from my last question (Recipe must be able to instantiate via RecipeIntrospectionUtils) I simplified the Recipe and test (see https://github.com/thomasrobertz/gd-refactor-sb3/tree/master) But the test fails:

java.lang.AssertionError: [de.robertz.SayHelloRecipe description should end with a period.] 
Expecting actual:
  "HelloDesc"
to end with:
  "."

"HelloDesc" is returned by my Recipe's method override:

    @Override
    public String getDescription() {
        return "HelloDesc";
    }

The getVisitor() override is never called. It seems the test is being wired up but there is something wrong. This might explain the earlier failure regarding RecipeIntrospectionUtils.

Maybe with these pointers someone is able to shed some light onto the issue?


Solution

  • We use our test framework also as a means to validate our recipes conform to standards, such that they look good on https://docs.openrewrite.org/.

    The way to fix your issue is to use

        @Override
        public String getDescription() {
            return "Any sentenced that ends with a dot.";
        }
    

    If you feel the message that you received could be improved let us know!