Jayesh is right. In your first code snippet, the employee id is a path variable, and the employee state is a request parameter. But in your second snippet (the test code), you have the reverse: the employee state is a path variable, and the employee id is a request parameter.
I already do this , but the problem is that Mockmvc.param attribute accept string so when i pass this as parameter(param("empstate", "Enums.EmplyeeState.PERMANENT"))
or without Apostrophe i have the same error(org.springframework.beans.TypeMismatchException)
String-based values extracted from the request including request parameters, path variables, request headers, and cookie values may need to be converted to the target type of the method parameter or field (e.g., binding a request parameter to a field in an @ModelAttribute parameter) they’re bound to. If the target type is not String, Spring automatically converts to the appropriate type. All simple types such as int, long, Date, etc. are supported. You can further customize the conversion process through a WebDataBinder (see the section called “Customizing WebDataBinder initialization”) or by registering Formatters with the FormattingConversionService (see Section 7.6, “Spring Field Formatting”).
I'm not sure but it could be that you need to write a custom formatter to convert String to ENum. I don;t know if Spring comes up with it's own default Formatter. But if it doesn;t you can write your own Formatter and register it with Spring MVC