Tabnine Logo
Assert.isTrue
Code IndexAdd Tabnine to your IDE (free)

How to use
isTrue
method
in
com.hbasesoft.framework.common.utils.Assert

Best Java code snippets using com.hbasesoft.framework.common.utils.Assert.isTrue (Showing top 13 results out of 315)

origin: ww20081120/framework

  public static void checkSql(String sql) {
    Assert.isTrue(sql.indexOf(GlobalConstants.ASTERISK) == -1, ErrorCodeDef.UNSUUPORT_ASTERISK);
  }
}
origin: ww20081120/framework

@Test
public void countCoursePass() {
  int count = studentDao.countCoursePass("语文");
  Assert.isTrue(count == 2, ErrorCodeDef.SYSTEM_ERROR_10001);
  System.out.println("语文考及格的有两人");
}
origin: ww20081120/framework

@Test
public void findByProperty() {
  List<StudentEntity> entities = studentDao.findByProperty(StudentEntity.class, StudentEntity.AGE, 18);
  Assert.isTrue(entities.size() == 2, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void findByQueryString() {
  List<StudentEntity> entities = studentDao
    .findByQueryString("from com.hbasesoft.framework.db.demo.entity.StudentEntity where id = '1'");
  Assert.isTrue(entities.size() == 1, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void loadAll() {
  List<StudentEntity> entities = studentDao.loadAll(StudentEntity.class);
  int size = studentDao.countStudentSize();
  Assert.isTrue(entities.size() == size, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void queryStudentCourse() {
  List<StudentEntity> entityes = studentDao.queryStudentCourse(null, 1, 5);
  Assert.isTrue(entityes.size() == 5, ErrorCodeDef.SYSTEM_ERROR_10001);
  entityes = studentDao.queryStudentCourse(null, 1, 3);
  Assert.isTrue(entityes.size() == 3, ErrorCodeDef.SYSTEM_ERROR_10001);
  StudentEntity entity = new StudentEntity();
  entity.setAge(19);
  entityes = studentDao.queryStudentCourse(entity, 1, 10);
  Assert.isTrue(entityes.size() == 3, ErrorCodeDef.SYSTEM_ERROR_10001);
  entity = new StudentEntity();
  entity.setAge(18);
  entity.setName("张%");
  entityes = studentDao.queryStudentCourse(entity, 1, 10);
  Assert.isTrue(entityes.size() == 3, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void getListByCriteriaQuery() {
  DetachedCriteria criteria = DetachedCriteria.forClass(StudentEntity.class);
  criteria.add(Restrictions.eq(StudentEntity.AGE, 18));
  List<StudentEntity> es1 = studentDao.getListByCriteriaQuery(criteria);
  List<StudentEntity> es2 = studentDao.findByProperty(StudentEntity.class, StudentEntity.AGE, 18);
  Assert.isTrue(es1.size() == es2.size(), ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void deleteAllEntitiesByIds() {
  int s1 = studentDao.countStudentSize();
  studentDao.deleteAllEntitiesByIds(StudentEntity.class, Arrays.asList("1", "2", "3"));
  int s2 = studentDao.countStudentSize();
  Assert.isTrue(s1 - s2 == 3, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Around("dulplicateLock()")
public Object invoke(ProceedingJoinPoint thisJoinPoint) throws Throwable {
  Signature sig = thisJoinPoint.getSignature();
  if (sig instanceof MethodSignature) {
    MethodSignature msig = (MethodSignature) sig;
    Object target = thisJoinPoint.getTarget();
    Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes());
    DulplicateLock dulplicateLock = AnnotationUtils.findAnnotation(currentMethod, DulplicateLock.class);
    if (dulplicateLock != null) {
      String key = dulplicateLock.name()
        + KeyUtil.getLockKey(dulplicateLock.key(), currentMethod, thisJoinPoint.getArgs());
      Assert.isTrue(redisCache.setnx(key, LOCKED, dulplicateLock.expireTime()),
        ErrorCodeDef.DULPLICATE_MESSAGE, key);
      try {
        // 加锁成功,执行方法
        return thisJoinPoint.proceed();
      }
      catch (Exception e) {
        redisCache.evict(key);
      }
    }
  }
  return thisJoinPoint.proceed();
}
origin: ww20081120/framework

@Test
public void deleteAllEntitie() {
  List<StudentEntity> entities = studentDao.loadAll(StudentEntity.class);
  studentDao.deleteAllEntitie(entities);
  int size = studentDao.countStudentSize();
  Assert.isTrue(size == 0, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void batchExecute() {
  int s1 = studentDao.countStudentSize();
  IOUtil.batchProcessFile(new File("Student.csv"), line -> {
    if (StringUtils.isNotEmpty(line)) {
      String[] strs = StringUtils.split(line, GlobalConstants.SPLITOR);
      if (strs.length >= 2) {
        return new Object[] {
          CommonUtil.getTransactionID(), strs[0], strs[1]
        };
      }
    }
    return null;
  }, (students, pageIndex, pageSize) -> {
    studentDao.batchExecute("insert into t_student (id, name, age) values (?, ?, ?)", students, 1000);
    return true;
  });
  int s2 = studentDao.countStudentSize();
  Assert.isTrue(s2 - s1 == 200000, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void batchSave() throws UnsupportedEncodingException, FileNotFoundException {
  int s1 = studentDao.countStudentSize();
  IOUtil.batchProcessFile(new File("Student.csv"), line -> {
    if (StringUtils.isNotEmpty(line)) {
      String[] strs = StringUtils.split(line, GlobalConstants.SPLITOR);
      if (strs.length >= 2) {
        StudentEntity entity = new StudentEntity();
        entity.setName(strs[0]);
        entity.setAge(Integer.parseInt(strs[1]));
        return entity;
      }
    }
    return null;
  }, (students, pageIndex, pageSize) -> {
    studentDao.batchSave(students);
    return true;
  }, 1000);
  int s2 = studentDao.countStudentSize();
  Assert.isTrue(s2 - s1 == 200000, ErrorCodeDef.SYSTEM_ERROR_10001);
}
origin: ww20081120/framework

@Test
public void getPageList() {
  DetachedCriteria criteria = DetachedCriteria.forClass(StudentEntity.class);
  PagerList<StudentEntity> entities = studentDao.getPageList(criteria, 1, 1);
  Assert.isTrue(entities.size() < entities.getTotalCount(), ErrorCodeDef.SYSTEM_ERROR_10001);
}
com.hbasesoft.framework.common.utilsAssertisTrue

Popular methods of Assert

  • notEmpty
    Description:
  • notNull
    Description:
  • equals
  • isNull
    Description:
  • notEquals

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • requestLocationUpdates (LocationManager)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now