package com.renrenliao.utils;

import static org.junit.Assert.*;

import android.util.Log;

import com.google.gson.Gson;
import com.renrenliao.im.bean.AppConfigEntity;
import com.renrenliao.im.config.Const;
import com.renrenliao.im.http.BaseResult;
import com.renrenliao.im.utils.DataCacheUtils;
import com.renrenliao.im.utils.DigestUtils;

import org.apache.commons.lang3.StringEscapeUtils;
import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.concurrent.atomic.AtomicBoolean;

public class StringUtilsTest {

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void isMobileNumber() {

//        Gson gson= new Gson();
//        String data = "{\"withdrawMinAmount\":\"100\",\"androidAddress\":\"https://rrim.oss-cn-beijing.aliyuncs.com/renrenliao.apk\",\"useMobileRegister\":\"0\",\"versionStatus\":0,\"iosAtt1\":\"抖一抖\",\"redPackBlessing\":\"恭喜發財\",\"iosAtt2\":\"https://apimg.alipay.com/\",\"ob\":\"1\",\"iosAtt3\":\"https://ccdcapi.alipay.com/\",\"apiUrl\":\"http://47.108.176.248\",\"inviteSwitch\":\"0\",\"imPort\":\"9903\",\"payAddress\":\"http://api.renrenim.com/defray/#/?payKey=138625c0fc6e4b28934f3e85fd02526e&vipUserId=10013016\",\"aliyunoss\":\"https://renrenim.seelinok.com/avatar/\",\"withdrawRate\":\"0.1\",\"iosAddress\":\"https://tf.kekouyun.vip/app/1578110577\",\"iosForceUpdateVersion\":\"100\",\"iosUpdateContent\":\"当前最新版本:1.0.1。#@1.UI改版#@2.针对部分机型修复了bug#@3.优化消息收发\",\"avatarVersion\":\"1589530066000\",\"userTerms\":\"https://im.177.me/legal.html\",\"iosVersion\":\"100\",\"androidTitle\":\"系统升级\",\"openAuth\":\"0\",\"androidUpdateContent\":\"当前最新版本:1.8.0。#@1.UI改版#@2.针对部分机型修复了bug#@3.优化消息收发\",\"uploadUrl\":\"http://josn.renrenim.net:100\",\"iosTitle\":\"人人聊升级\",\"headImgRefreshTime\":\"86400000\",\"payJump\":\"0\",\"imAddr\":\"47.108.176.248\"}";
//        AppConfigEntity config = gson.fromJson(data,AppConfigEntity.class);
//        BaseResult baseResult = new BaseResult(1,"message",config,true);
//
//        System.out.println(gson.toJson(baseResult));
//        Stu stu = new Stu();
//        stu.setName("aa");
//        stu.setAge(18);
//        stu.setSex("bb");
//
//        Stu stu1 = stu.clone();
//
//        System.out.println(stu);
//        System.out.println(stu1);
//        System.out.println(stu1);
//        AtomicBoolean a =new AtomicBoolean(false);
//        System.out.println(a.compareAndSet(true,true));
//        System.out.println(a.get());
//        String str = "{\"status\":200,\"data\":\"[{\"addTime\":1653727700000,\"bankAccountAddress\":\"\",\"bankCardAvatar\":\"https://apimg.alipay.com/combo.png?d=cashier&t=ICBC\",\"bankCardNumber\":\"6222024402027354696\",\"bankCardTailNumber\":\"4696\",\"bankCode\":\"ICBC\",\"bankName\":\"中国工商银行\",\"id\":5,\"isNotDel\":0,\"updateTime\":1653727700000,\"userName\":\"asdas\",\"userUid\":10026290}]\",\"msg\":\"OK\"}";
//        str = StringEscapeUtils.unescapeJava(str);
//        System.out.println(str);
//        String s = Const.APICODE + "1655095523136";// + "100005" + "33efdd52a7fe40dd9ce9007d456301ea";
//
//        String ss =         DigestUtils.md5(s);
//        System.out.println(ss);
     //   String uid = DataCacheUtils


        String avatarUrl = "https://renreni.oss-accelerate.aliyuncs.com/avatar/user/10027397/10027397.png";
        int start = avatarUrl.lastIndexOf("/")+1;
        int end = avatarUrl.lastIndexOf(".");
        String s = avatarUrl.substring(start,end);
        System.out.println(s);
    }



}