Package com.sishuok.mvc.entity

Examples of com.sishuok.mvc.entity.User


        mockServer.verify();
    }

    @Test
    public void testUpdate() throws Exception {
        User user = new User();
        user.setId(1L);
        user.setName("zhang");

        String uri = baseUri + "/{id}";

        mockServer
                .expect(requestTo(uri))  //验证请求URI
                .andExpect(jsonPath("$.name").value(user.getName())) //验证请求的JSON数据
                .andRespond(withNoContent()); //添加响应信息

        restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(new MappingJackson2HttpMessageConverter()));
        ResponseEntity responseEntity = restTemplate.exchange(uri, HttpMethod.PUT, new HttpEntity<>(user), (Class) null, user.getId());

        assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());

        mockServer.verify();
    }
View Full Code Here



    @Test
    public void testNestedProperty() {
        List<User> userlist = new ArrayList<>();
        User user1 = new User();
        user1.setId(1L);
        user1.setName("zhang");

        User user2 = new User();
        user2.setId(2L);
        user2.setName("admin");
//        user2.setUser2(user2);

        userlist.add(user1);
        userlist.add(user2);
View Full Code Here

@RequestMapping("/user")
public class UserController {

    @RequestMapping("/{id}")
    public ModelAndView view(@PathVariable("id") Long id, HttpServletRequest req) {
        User user = new User();
        user.setId(id);
        user.setName("zhang");

        ModelAndView mv = new ModelAndView();
        mv.addObject("user", user);
        mv.setViewName("user/view");
        return mv;
View Full Code Here

*/
@Service
public class UserServiceImpl implements UserService {

    public User findById(Long id) {
        User user = new User();
        user.setId(id);
        user.setName("zhang");
        return user;
    }
View Full Code Here

TOP

Related Classes of com.sishuok.mvc.entity.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.