apache / apache/parquet-java

Introduce AssertJ for testing

Aperta
#3,615 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Type: enhancement
Lingua principale
Java
Stelle
3.1k
Fork
1.6k
Merge medio
3g 12h
PR unite (30g)
33

Descrizione

### Describe the enhancement requested

AssertJ gives us readable, fluent assertions that make tests easier to write and failures easier to analyze. With JUnit's `assertEquals(expected, actual)` it's easy to mix up argument order, and you end up with confusing failure messages. AssertJ's `assertThat(actual).isEqualTo(expected)` reads naturally and always gets the order right. Additionally, it provides a lot of flexibility when asserting things.

Compound checks that need multiple JUnit assertions collapse into a single chain:

```
// JUnit
assertNotNull(list);
assertEquals(3, list.size());
assertTrue(list.contains("foo"));
```
```
// AssertJ
assertThat(list).hasSize(3).contains("foo");
```

When something fails, AssertJ tells you exactly what went wrong and makes debugging much easier, because the failure message usually contains enough details to understand the issue. For example, an assertion on a list would fail with `expected list to contain 'foo' but was ['bar', 'baz']`. JUnit assertions on the other hand would only contain `expected true but was false`.

It also covers cases where JUnit assertions are just clunky: exception messages, collection contents, map entries, string patterns, comparisons with custom comparators. All without needing Hamcrest matchers or custom helper methods.

I'm planning to add it as a project-wide test dependency so new tests can use it immediately. Existing tests don't need to be migrated, and we can move them over incrementally where it makes sense.

### Component(s)

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Non sono indicati file o test. Inizia individuando la configurazione delle dipendenze di test a livello di progetto e verifica come vengono dichiarate le dipendenze di test esistenti; il lavoro è completato quando AssertJ è disponibile per i nuovi test senza migrare i test esistenti e la build di test del progetto ha esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
testing
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
62/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.