Replace JUnit Timeout Annotation Property with assertTimeout

Replace JUnit Timeout Annotation Property with assertTimeout

#jSparrow adds this new rule to help migrating to JUnit 5!

Rule: Replace JUnit Timeout Annotation Property with assertTimeout

The JUnit Jupiter API provides timeout assertions, i.e., assertions that make sure an executable completes before a timeout is exceeded.

In JUnit 4 this is achieved by using annotation properties, e.g., @Test(timeout=...).

This rule removes the timeout annotation property and inserts an assertTimeout instead. For example, the following test case:

Es wurde kein Alt-Text für dieses Bild angegeben.

is refactored to:

Es wurde kein Alt-Text für dieses Bild angegeben.

This brings jSparrow to a total of 91 automatic refactoring rules.

Find out more information in the Release Notes for jSparrow Eclipse and jSparrow Maven!

"With good program architecture debugging is a breeze, because bugs will be where they should be."

― David May

Happy Coding!


要查看或添加评论,请登录

Michaela Prehofer的更多文章

  • Amber

    Amber

    Project Amber is a current initiative of the developers of Java and OpenJDK, which aims to make some small but…

  • Replace JUnit assertThat with Hamcrest

    Replace JUnit assertThat with Hamcrest

    This new jSparrow release eliminates some obstacles for migrating to JUnit 5! The JUnit Assert.assertThat method is…

  • What to expect on the international Java Refactoring Day

    What to expect on the international Java Refactoring Day

    On this day we exclusively and objectively look at the topic of software refactoring. Here we would like to present a…

  • Refactoring but how?

    Refactoring but how?

    Abstract: Spreaker Horst Kargl start at 05:00 pm CET Refactoring is rewriting code that does not change its behavior…

  • "It works after all! - isn't enough!"

    "It works after all! - isn't enough!"

    Abstract: Speaker Michaela Prehofer start at 04.35 pm CET Why should CEOs or shareholder be interested in ensuring that…

  • Source Code Refactoring

    Source Code Refactoring

    Abstract: Speaker Ardit Ymeri start at 06:10 pm CET Why is Java Refactoring needed from a technical point of view? The…

  • How can we determine or even prove the quality of software?

    How can we determine or even prove the quality of software?

    Abstract: Speaker Reinhard Prehofer start at 05:35 pm CET This is totally unreadably, incomprehensible, unmaintainable:…

  • Why is refactoring so necessary at this time?

    Why is refactoring so necessary at this time?

    Abstract: Speaker Thomas Tschernitschek start at 04:00 pm CET ?Digital transformation is the integration of digital…

  • This new #jSparrow release brings further assistance in migrating to JUnit 5!

    This new #jSparrow release brings further assistance in migrating to JUnit 5!

    jSparrow 3.27.

    1 条评论
  • Java 8 features every developer must-have.

    Java 8 features every developer must-have.

    Even today, a Java developer is asked about the features of Java 8. But now, Oracle no longer provides free support for…

    2 条评论

社区洞察

其他会员也浏览了