EasyMock + Spring的Mock
本来想模拟JSF的 FacesContext.getCurrentInstance().getExternalContext().getRequest()
来获得Principal 但发现比较麻烦,所以只实现模拟HttpServletRequest
使用EasyMock + Spring的MockObject做较为简单
1 | Principal principal = EasyMock.createMock(Principal.class); |