/** for insert new user */
  private Role insertRole(String name, String code) {
    Role role = new Role(name, code);
    int rows = roleMapper.insert(role);

    assertTrue("Insert Role does not success!", rows == 1);

    assertNotNull(role.getId());

    return role;
  }
  @Test
  @Transactional
  public void testSelect() throws Exception {
    List<User> maleUsers = Lists.newArrayList();

    for (int i = 0; i < 10; i++) {
      String name = "makersoft-vertical_" + i;
      String password = "******" + i;
      int age = i;
      int gender = (i % 2) == 0 ? User.SEX_MALE : User.SEX_FEMALE;

      User user = this.insertUser(name, password, age, gender);

      if (gender == User.SEX_MALE) {
        maleUsers.add(user);
      }
    }

    List<User> users = userMapper.findByGender(User.SEX_MALE);
    assertTrue("find by gender total size error " + users.size(), users.size() == 5);

    assertTrue(maleUsers.containsAll(users));

    List<Role> allRoles = Lists.newArrayList();
    for (int i = 0; i < 10; i++) {
      String name = "ROLE_" + i;
      String code = "CODE_" + i;

      Role role = this.insertRole(name, code);
      allRoles.add(role);
    }

    List<Role> roles = roleMapper.findAll();

    assertTrue(allRoles.containsAll(roles));
  }