/** for insert new user */ private User insertUser(String username, String password, int age, int gender) { User user = new User(username, password, gender); user.setAge(age); int rows = userMapper.insertUser(user); assertTrue("Insert User does not success!", rows == 1); assertNotNull(user.getId()); return user; }
@Test @SuppressWarnings("unchecked") public void testObject() throws Exception { User user = new User(); user.setId("id"); user.setUsername("makersoft"); user.setPassword("password"); user.setAge(20); Object obj = ParameterUtil.resolve(user, shardId); Assert.assertTrue(obj instanceof Map); Map<String, Object> map = (Map<String, Object>) obj; Assert.assertEquals(PREFIX_VALUE, map.get(PREFIX)); Assert.assertEquals(SUFFIX_VALUE, map.get(SUFFIX)); Assert.assertEquals(user.getId(), map.get("id")); Assert.assertEquals(user.getUsername(), map.get("username")); Assert.assertEquals(user.getPassword(), map.get("password")); Assert.assertEquals(user.getAge(), map.get("age")); }