0

I was wondering if there is a way to add a custom variable when using the assertj-assertions-generator-maven-plugin. I would like to introduce a variable in the maven pom that would be the entry point class name. What I have found in multi-module projects using the default EntryPointClass is that you end up with multiple classes called Assertions. This gets confusing if using test jars between modules in a project. What I have done in the past is have a custom assertionsEntryPointClass like the below. However, what I would really like is to be able to define a variable in the pom (say AssertionsEntryPointClassName) that I could use in the template.

Here is what I use today:

package ${package};

@javax.annotation.Generated(value="assertj-assertions-generator")
public class MyModuleAssertions {

${all_assertions_entry_points}

  protected MyModuleAssertions() {
    // empty
  }
}

What I would like to have would be this:

package ${package};

@javax.annotation.Generated(value="assertj-assertions-generator")
public class ${AssertionsEntryPointClassName}Assertions {

${all_assertions_entry_points}

  protected ${AssertionsEntryPointClassName}Assertions() {
    // empty
  }
}

John B
  • 32,493
  • 6
  • 77
  • 98
  • I'm afraid the AssertJ team has not the capacity to work on the generator or its maven plugin at the moment, a bit sad unfortunately :( – Joel Costigliola Sep 16 '22 at 04:53
  • @JoelCostigliola and the current code does not pull any variables that could be set by maven? Environment variables, etc? – John B Sep 16 '22 at 11:42
  • Here's the old doc that shows the possible config http://joel-costigliola.github.io/assertj/assertj-assertions-generator-maven-plugin.html#configuration http://joel-costigliola.github.io/assertj/assertj-assertions-generator.html#generated-assertions-templates list the supported variables – Joel Costigliola Sep 19 '22 at 04:38

0 Answers0