/**
 * $Id: Assert.java 8999 2016-05-24 07:37:31Z anjiabin $
 * Copyright(C) 2014-2020 easegame, All Rights Reserved.
 */
package com.liquidnet.commons.lang.util;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Pattern;

/**
 * @author <a href="mailto:cafebabe.hu@gmail.com">Xiaowei Hu</a>
 * @version 1.0 2016年05月24日 3:10 PM:00
 */
public abstract class Assert extends org.springframework.util.Assert {

    /**
     * 是否手机号
     *
     * @param mobile    手机号
     */
    public static void isMobile(String mobile) {
        Pattern pattern = Pattern.compile("^1\\d{10}$");
        if (StringUtils.isEmpty(mobile) || !pattern.matcher(mobile).matches()) {
            throw new IllegalArgumentException("the argument must be mobile format: " + mobile);
        }
    }

    public static void main(String [] args){
         isMobile("28601350342");
    }
}
