Apress / pivotal-certified-pro-spring-dev-exam-02

Source Code for 'Pivotal Certified Professional Core Spring 5 Developer Exam' by Iuliana Cosmina
Other
170 stars 240 forks source link

NotFoundException should be RuntimeException and com.apress.cems.practice renamed to com.apress.cems.boot.practice #13

Closed A60678 closed 3 years ago

A60678 commented 4 years ago

1) chapter06/mvc-basic-practice is using the NotFoundException as a checked Exception and chapter06/mvc-basic as an unchecked RuntimeException, we should unify this.

2) In order to avoid the IllegalStateException exception, the package com.apress.cems.practice should be renamed to com.apress.cems.boot.practice in chaptr06/boot-web-practice. This way com.apress.cems.boot.practice.SpringBootWebApplicationTest can easily find @SpringBootConfiguration. Otherwise we would get the following exception and the practicioner would need to change the source outside of the TODOs' scope.

Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

iuliana commented 3 years ago

Hello @A60678,

Although what you did there assumingly works, that doesn't make it suitable for this example. Since I am mocking the service used by this test, this means that I don't really need a more complex test context.

If the test fails there must be a different problem. It might be related to the upgrade to JDK 13. I'll take a look at it as soon as I can.

Cheers, Iuliana Cosmina

iuliana commented 3 years ago

Issues reporeted are correct and reproducible. Fixes were introduced by commit https://github.com/Apress/pivotal-certified-pro-spring-dev-exam-02/commit/b410fce199b46767eebcb101e09c70e66950ae13. The code is different than the one on this branch, so I am closing this. Thank you for your contribution!