The generator is a little too greedy with Iterable of Path and make tests fails
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
Inizia decomprimendo l'esempio assertj-foo.zip collegato ed eseguendo FooTest per riprodurre l'asserzione hasPath che fallisce. Traccia il modo in cui il generatore gestisce i tipi che implementano java.lang.Iterable, inclusa la distinzione rispetto a java.util.Collection. Il lavoro è completato quando i tipi Iterable simili a Path usano la semantica di uguaglianza, mentre i tipi Collection mantengono i propri predicati Collection, e il test ha esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With 2.1.0 version, the generator is too greedy when encountering a class implementing an java.lang.Iterable. It should ignore it unless the type extends java.util.Collection (where that make sense) or explicitly a java.lang.Iterable (where it is harder to tell it makes sense).
Sample classes: assertj-foo.zip
The test (FooTest) will fail because the usage of hasPath is NOT the same than using an iterable: we want to test an equals rather than a collection predicate. Here the exception: java.lang.AssertionError: Expecting: <foobar\a>to contain: <[foobar\a]>but could not find: <[foobar\a]>
A working alternative is to convert the Path into a List extracting the Iterable content, but that is wrong by all means:
- first, the default semantic is not good (the default = search for subsequence in any order)
- second, as an user, I want to test the path using
equals(and that is what the generator produce if I have a class not implementingjava.lang.Iterable):
final List<Path> paths = new ArrayList<>();
test.forEach(paths::add); // says ["foobar", "A"]
assertThat(foo).hasPath(paths);
- Lingua principale
- Java
- Stelle
- 72
- Fork
- 47
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di assertj/assertj-generator
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
assertj/assertj-generator#278 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
assertj/assertj-generator#220 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
assertj/assertj-generator#219 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
assertj/assertj-generator#204 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
assertj/assertj-generator#197 · 7 commenti ·
Tutte le issue di assertj/assertj-generator
Issue simili
-
type: possible bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
grimmory-tools/grimmory#2850 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
aoqia194/leaf-loader#19 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/streampark#4521 ·