assertj / assertj/assertj-generator

Discussion: Use of template engine over custom solution

Ouverte
#103 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
72
Forks
47
Merge moyen
1 j 16 h
PR mergées (30 j)
2

Description

This is not an issue, but a discussion as I've run into a bit of a road-block in my work.

Currently, the generator is configurable via changing the template values as shown [here](http://joel-costigliola.github.io/assertj/assertj-assertions-generator.html#generated-assertions-templates). The problem I'm having is that I want to add logic into these templates to, for example, generate a new assertion that is _only_ relevant to my classes. If I want to do this, I have to write my own parser logic and call the required templates -- rather than just loading new templates.

I think one of the simplest ways to allow more flexibility is to remove the template engine from the generator and focus on using an existing engine with predefined templates. I believe the primary value of the generator is generating the model of assertions (e.g. `ClassDescription`) and their associating naming conventions to allow for generating these assertions. We can use this model within another engine to generate assertions

* [Apache FreeMarker](http://freemarker.org) - tried and true, works easily and is well known. Many features available. Additionally, uses a similar syntax for the "base" templates that we have already (`${variable}`).
* [jtwig](http://jtwig.org) - Neat new engine I've not heard of, but looks incredibly nice. Similar feature set
* [Thymeleaf](http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html) - widely used, but I don't think it's well suited to work outside its domain of web generation

Looking for some input in this as I'm unsure if there were previously decisions made or after the fork it was just kept up as legacy. :)

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par examiner l’implémentation existante des templates du generator et le modèle ClassDescription mentionné dans la discussion. Comparez les approches proposées avec FreeMarker, jtwig et Thymeleaf au regard du besoin d’une logique d’assertion personnalisée ; c’est terminé lorsqu’une orientation commune a été définie et que le périmètre de migration a été établi.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.