Created
October 31, 2012 22:08
Constants in Unit Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class ShowUserController { | |
public static final String SUCCESS_VIEW = "showUser"; // Key Constant (moved here from the test class) | |
@RequestMapping(method = RequestMethod.GET) | |
public ModelAndView showUser(@PathVariable long userId) { | |
ModelAndView modelAndView = new ModelAndView(); | |
modelAndView.setViewName(SUCCESS_VIEW); | |
modelAndView.setModel(buildModel(userId)); | |
return modelAndView; | |
} | |
private UserValueObject buildModel(long userId) { | |
// creating the value object for presentation in here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment