zoukankan      html  css  js  c++  java
  • MyStringUtils test

    package com.spider.util;

    import java.util.LinkedHashMap;

    import org.junit.Test;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;

    import junit.framework.Assert;

    public class StringUtilsTest {
        private static final Logger logger=LoggerFactory.getLogger(StringUtilsTest.class);
        @Test
        public void FormatTest()
        {
            String actual=StringUtils.Format("dddddddddddd   {0}", "111");
            String expected="dddddddddddd   111";
            logger.debug(actual);
            Assert.assertEquals(expected, actual);
           
            actual=StringUtils.Format("dddddddddddd   {0}\"{1}\"", "111","22");
            expected="dddddddddddd   111\"22\"";
            Assert.assertEquals(expected, actual);
           
           
        }
        @Test
        public void HashMap2JSONStringTest()
        {
            LinkedHashMap<String, String> ht=new LinkedHashMap<String, String>();
            ht.put("ip","127.0.0.1");
            ht.put("hostname", "haha");
            ht.put("version", "20120318");
            String str=StringUtils.HashMap2JSONString(ht);
            System.out.println(str);
        }

    }

  • 相关阅读:
    [OpenCV] Ptr类模板
    [OpenCV]Mat类详解
    [C++] Vector用法
    [OpeCV] highgui头文件
    c++中的.hpp文件
    【2017】KK English
    CMake Tutorial & Example
    [g2o]C++图优化库
    Teradata基础教程中的数据库试验环境脚本
    Oracle中对象权限与系统权限revoke
  • 原文地址:https://www.cnblogs.com/lexus/p/2406122.html
Copyright © 2011-2022 走看看