assertj / assertj/assertj-generator

For boolean properties, support "hasPropertyName(boolean expectedValue)"

Aperta
#125 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
72
Fork
47
Merge medio
1g 16h
PR unite (30g)
2

Descrizione

Currently if a class has a boolean field / property (say **hideLegend,** the assertion generator produces two methods: **isHideLegend()** and **isNotHideLegend**. It would be really helpful to have an additional method **hasHideLegend(boolean expectedValue)**. To keep with the **BooleanAssert** pattern, this might become **hasHideLegendEqualTo(boolean)** and **hasHideLegendNotEqualTo(boolean)**. This is demonstrated by the example below:

```
private void testHelperMethod(MyAssertionClass instanceUnderTest, SomeInput input){
boolean expectedHasLegend = // some code that uses input to determine expected legend;
MyAssertionClassAssert assert = Assertions.assertThat(instanceUnderTest);

if (expectedHadLengeng)
assert.isHideLegend();
else
assert.isNotHideLegend();
}
```

The above could become:

```
private void testHelperMethod(MyAssertionClass instanceUnderTest, SomeInput input){
boolean expectedHasLegend = // some code that uses input to determine expected legend;
Assertions.assertThat(instanceUnderTest)
hasHideLegend(expectedHasLegend );
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia individuando la logica del generatore di assertion che crea metodi per le proprietà booleane, quindi confronta l’API richiesta con il pattern BooleanAssert esistente. Decidi se il metodo generato debba essere hasHideLegend(boolean) o varianti specifiche per l’uguaglianza, e aggiungi una copertura che dimostri che l’assertion generata gestisce entrambi i valori booleani attesi.

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

Valutazione

Stack tecnologico
java
Ambito
testing, tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.