How to pass a ingredientGroup? Or is there some other way?
Controller:
@Controller
@RequestMapping("/ingredients/groups")
@RequiredArgsConstructor
@PermissionUserWrite
public class IngredientGroupController {
    private static final String VIEWS_PATH = "/pages/ingredient/group/";
    private final IngredientGroupService ingredientGroupService;
    @GetMapping("{id}")
    public String show(@PathVariable("id") IngredientGroup group, Model model) {
        if (group == null) {
            throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Ingredient group not found");
        }
        model.addAttribute("group", group);
        return VIEWS_PATH + "show";
    }
}
Test:
@SpringBootTest
@AutoConfigureMockMvc
class IngredientGroupControllerTest {
    private static final String VIEWS_PATH = "/pages/ingredient/group/";
    @Autowired
    private MockMvc mockMvc;
    @Test
    @WithMockAdmin
    void show_for_admin() throws Exception {
        var ingredientGroup = Mockito.mock(IngredientGroup.class);
        mockMvc.perform(MockMvcRequestBuilders.get("/ingredients/groups/{id}", 1))
                .andExpect(status().isOk())
                .andExpect(view().name(VIEWS_PATH+"show"));
    }
}
 
    