Class ExpectedExceptionToAssertThrows


  • public class ExpectedExceptionToAssertThrows
    extends org.openrewrite.Recipe
    Replace usages of JUnit 4's @Rule ExpectedException with JUnit 5 Assertions.

    Supported ExpectedException methods: expect(java.lang.Class) expect(org.hamcrest.Matcher) expectMessage(java.lang.String) expectMessage(org.hamcrest.Matcher) expectCause(org.hamcrest.Matcher)

    Does not currently support migration of ExpectedException.isAnyExceptionExpected().

    • Constructor Detail

      • ExpectedExceptionToAssertThrows

        public ExpectedExceptionToAssertThrows()
    • Method Detail

      • getDisplayName

        public java.lang.String getDisplayName()
        Specified by:
        getDisplayName in class org.openrewrite.Recipe
      • getEstimatedEffortPerOccurrence

        public java.time.Duration getEstimatedEffortPerOccurrence()
        Overrides:
        getEstimatedEffortPerOccurrence in class org.openrewrite.Recipe
      • getDescription

        public java.lang.String getDescription()
        Overrides:
        getDescription in class org.openrewrite.Recipe
      • getSingleSourceApplicableTest

        protected org.openrewrite.TreeVisitor<?,​org.openrewrite.ExecutionContext> getSingleSourceApplicableTest()
        Overrides:
        getSingleSourceApplicableTest in class org.openrewrite.Recipe
      • getVisitor

        protected org.openrewrite.TreeVisitor<?,​org.openrewrite.ExecutionContext> getVisitor()
        Overrides:
        getVisitor in class org.openrewrite.Recipe