spring-boot: Migrate from ExpectedException rule to AssertJ

We should consider migrating from @ExpectedException to AssertJ. This will help if/when we upgrade to JUnit 5.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 24 (12 by maintainers)

Most upvoted comments

@ivange94 Thanks for the offer to help but I’ve managed to migrate the tests now using a combination of search/replace, regex, refactoring, and sheer willpower 😃

@philwebb you’re right, this is a time consuming change. It gets boring doing the same thing over and over again. I’ll look at the label but will still continue working on this. If can get the script working fine else I’ll do it manually.

I also found assertThatExceptionOfType felt more natural and that’s what I’ve been using.

+1 for assertThatExceptionOfType . The javadoc also says it’s more or less the same as assertThatThrownBy but in a more natural way.

@snicoll thanks for the quick response. I’m proceeding with working on this.