on-internet
← Community

error "java.lang.AssertionError: Content type not set" when implementing controller unit test

Stack Overflow ·

I am implementing an integration test on a method of a controller Here is the controller method @PutMapping(value="/create", produces = MediaType.APPLICATION_JSON_VALUE, consumes=MediaType.APPLICATION_JSON_VALUE) @ResponseBody public SubscriptionDto createSubscription(@RequestBody SubscriptionDto subscriptionDto) throws IllegalCreationException { subscriptionService.checkValidityOfNewSubscription(subscriptionDto); subscriptionDto = subscriptionService.createSubscription(subscriptionDto); return subscriptionDto; } and when I test the request mockMvc.perform(put("/subscription/create") .contentT

Comments

Sign in or sign up to comment and upvote.

No comments yet.