cloud-native-spring-in-action icon indicating copy to clipboard operation
cloud-native-spring-in-action copied to clipboard

I find a blemish when I write slice test in chapter 12.3.2

Open ongiant opened this issue 1 year ago • 0 comments

  1. Through creating the OrderControllerWebFluxTests, I noticed that ReactiveJwtDecoder MockBean was ultimately not utilized. The same appears to be true for JwtDecoder MockBean within the BookControllerMvcTests class in section 12.2.3. These injections seem to be superfluous and may need to be reevaluated.
  2. In my opinion, the endpoint in OrderService would be more logically protected under the customer role, and there are a couple of reasons for this thought process: $\quad$ (1) Within the OrderControllerWebFluxTests class, the whenBookNotAvailableThenRejectOrder method utilizes webTestClient to send a mock request with a mock jwt holding the ROLE_customer authority. This test method would render moot if all requests were allowed to pass. $\quad$ (2) It seems unreasonable to me that a guest should have the ability to submit an order without the appropriate permissions.

Therefore, restricting this action could be beneficial for our application control.

ongiant avatar Dec 24 '23 19:12 ongiant