Comments (6)
Would the following be ok?
<configuration>
<templates>
<template>
<key>ABSTRACT_ASSERT_CLASS</key>
<!-- absolute or relative path -->
<file>whatever/template.txt</file>
</template>
</templates>
<!-- snip -->
</configuration>
from assertj-assertions-generator-maven-plugin.
Let's reuse slightly modified constants of BaseAssertionGenerator
:
IS_ASSERTION_TEMPLATE
HAS_ELEMENTS_ASSERTION_TEMPLATE_FOR_ARRAY
HAS_ELEMENTS_ASSERTION_TEMPLATE_FOR_ITERABLE
HAS_ASSERTION_TEMPLATE
HAS_ASSERTION_TEMPLATE_FOR_PRIMITIVE
HAS_ASSERTION_TEMPLATE_FOR_REAL_NUMBER
ASSERTION_CLASS_TEMPLATE
HIERARCHICAL_ASSERTION_CLASS_TEMPLATE
ABSTRACT_ASSERTION_CLASS_TEMPLATE
ASSERTIONS_ENTRY_POINT_CLASS_TEMPLATE
ASSERTION_ENTRY_POINT_METHOD_TEMPLATE
SOFT_ENTRY_POINT_ASSERTIONS_CLASS_TEMPLATE
JUNIT_SOFT_ENTRY_POINT_ASSERTIONS_CLASS_TEMPLATE
SOFT_ENTRY_POINT_ASSERTION_METHOD_TEMPLATE
BDD_ENTRY_POINT_ASSERTIONS_CLASS_TEMPLATE
BDD_ENTRY_POINT_ASSERTION_METHOD_TEMPLATE
I have just made this changes:
CUSTOM_ASSERTION_CLASS_TEMPLATE -> ASSERTION_CLASS_TEMPLATE
CUSTOM_HIERARCHICAL_ASSERTION_CLASS_TEMPLATE -> HIERARCHICAL_ASSERTION_CLASS_TEMPLATE
CUSTOM_ABSTRACT_ASSERTION_CLASS_TEMPLATE -> ABSTRACT_ASSERTION_CLASS_TEMPLATE
to be consistent, let's do that renaming in BaseAssertionGenerator
along with the default file names, ie:
static final String DEFAULT_CUSTOM_ASSERTION_CLASS_TEMPLATE = "custom_assertion_class_template.txt";
static final String DEFAULT_CUSTOM_HIERARCHICAL_ASSERTION_CLASS_TEMPLATE = "custom_hierarchical_assertion_class_template.txt";
static final String DEFAULT_CUSTOM_ABSTRACT_ASSERTION_CLASS_TEMPLATE = "custom_abstract_assertion_class_template.txt";
should be
static final String DEFAULT_ASSERTION_CLASS_TEMPLATE = "assertion_class_template.txt";
static final String DEFAULT_HIERARCHICAL_ASSERTION_CLASS_TEMPLATE = "hierarchical_assertion_class_template.txt";
static final String DEFAULT_ABSTRACT_ASSERTION_CLASS_TEMPLATE = "abstract_assertion_class_template.txt";
from assertj-assertions-generator-maven-plugin.
I like the renaming.
What do you think of my proposal above for the pom.xml?
from assertj-assertions-generator-maven-plugin.
Oh, i have to use the Mojo parameter type Map therefore the resulting structure would be
<configuration>
<templates>
<IS_ASSERTION_TEMPLATE>whatever/template.txt</IS_ASSERTION_TEMPLATE>
</templates>
<!-- snip -->
</configuration>
from assertj-assertions-generator-maven-plugin.
I prefer your latest suggestion but everything lowercase
<configuration>
<templates>
<is_assertion_template>whatever/template.txt</is_assertion_template>
</templates>
<!-- snip -->
</configuration>
from assertj-assertions-generator-maven-plugin.
My first proposal for that issue is ready but it lacks in two things which is open for discussion:
- It was not possible for me to use the Template(Type, File) constructor because it always results in an NPE when i had used the plugin in a test project. I couldn't figure out why it is thrown. So the template file reading is now part of the maven plugin generator which i consider as a workaround
- My test project contains the following snippet which leads to a lot of writing considering the directory when somebody has more then one template . This can be simplified by introducing another parameter templateDir which would be used if the path is a relative one.
<templates>
<has_for_primitive>target/classes/custom_has_assertion_template_for_primitive.txt</has_for_primitive>
</templates>
You wrote you have made changes. Where can i found them?
from assertj-assertions-generator-maven-plugin.
Related Issues (20)
- Plugin fails if there is a space in project directory path
- Plugin is a Maven 2.x plugin, which will be not supported in Maven 4.x HOT 1
- Use Objects::deepEquals instead of deprecated Objects::areEqual
- Is this project still maintained? HOT 1
- Make build fail if assertion classes could not be generated HOT 1
- Only create assertion class when it does not exist or when the associated class has changed HOT 3
- custom_assertion_class does not use generateAssertionsInPackage HOT 5
- Custom templates not found in multi-module projects HOT 2
- Add option to make the generated SoftAssertions implement AutoCloseable HOT 2
- Allow for client-specified name for Assertions class HOT 1
- Plugin is generating assertions for test classes and code generated by other plugins HOT 1
- Running Assertj Generator with JDK 11 gives non-compiling code HOT 1
- A required class was missing while executing org.assertj:assertj-assertions-generator-maven-plugin:2.1.0:generate-assertions: org.junit.rules.TestRule HOT 3
- Exclude package private classe references from entry points assertions
- Plugin randomly generates classes that don't compile HOT 1
- Can I select packages with wildcard ? HOT 7
- Cut a new release for new `assertj-assertions-generator` version HOT 4
- Mark plugin as thread-safe HOT 1
- Update version of assertj-core HOT 1
- allow the jakarta version of `@Generated` instead of the javax one. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assertj-assertions-generator-maven-plugin.