Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Update unit test to avoid deprecated `ExpectedException.none()` by using `Assert.assertThrows()`

Aperta
#275 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Cerca nel repository ExpectedException.none(), expectIllegalStateIsNotShowingComponent e expectIllegalStateIsDisabledComponent per identificare tutti gli unit test e gli helper interessati. Esegui la suite di unit test pertinente prima e dopo le sostituzioni; il lavoro è completato quando gli utilizzi deprecati sono stati rimossi e i test mantengono le asserzioni esistenti sulle eccezioni e sui messaggi.

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

Descrizione

ExpectedException.none() is marked as deprecated but there are so many unit tests which depends on the function.
These cases can be rewritten by using Assert.assertThrows(Class<?> class, ThrowableRunnable run)

There are also Similar deprecation; expectIllegalStateIsNotShowingComponent and expectIllegalStateIsDisabledComponent

These can be implemented as like as followings;


  public static AbstractStringAssert<?> assertThatIllegalStateExceptionCauseIsDisabledComponent(ThrowingRunnable r) {
      Throwable t = Assert.assertThrows(IllegalStateException.class, r);
      return assertThat(t.getMessage()).contains("Expecting component").contains("to be enabled");
  }

  public static AbstractStringAssert<?> assertThatIllegalStateExceptionCauseIsNotShowingComponent(ThrowingRunnable r) {
      Throwable t = Assert.assertThrows(IllegalStateException.class, r);
      return assertThat(t.getMessage()).contains("Expecting component").contains("to be shown on the screen");
  }
  public static AbstractStringAssert<?> assertThatIllegalStateExceptionCauseIsNotResizableComponent(ThrowingRunnable runnable) {
    Throwable t = Assert.assertThrows(IllegalStateException.class, runnable);
    return assertThat(t.getMessage()).contains("Expecting component").contains("to be resizable by the user");
  }
Lingua principale
Java
Stelle
121
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di assertj/assertj-swing

Tutte le issue di assertj/assertj-swing

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.