/*
 * Copyright (C) 2008 feilong
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.feilong.core.net.uriutiltest;

import java.net.URI;

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

import com.feilong.core.net.URIParseException;
import com.feilong.core.net.URIUtil;

/**
 * The Class URIUtilTest.
 * 
 * @author <a href="http://feitianbenyue.iteye.com/">feilong</a>
 */
public class URIUtilCreateTest{

    /** The Constant LOGGER. */
    private static final Logger LOGGER = LoggerFactory.getLogger(URIUtilCreateTest.class);
    //***************com.feilong.core.net.URIUtil.create(String)************************************************************************

    /**
     * Test create.
     */
    @Test
    public void testCreate(){
        String value = "http://xy2.cbg.163.com/cgi-bin/equipquery.py?server_name=风花雪月&query_order=selling_time DESC&search_page&areaid=2&server_id=63&act=search_browse&equip_type_ids&search_text=斩妖剑";
        value = "http://xy2.cbg.163.com/cgi-bin/equipquery.py?server_name=风花雪月&query_order=selling_time";
        URI uri = URIUtil.create(value);
        LOGGER.debug("{}", uri.toString());
    }

    /**
     * Test create3.
     */
    @Test
    @Ignore
    public void testCreate3(){
        String uriString = "http://127.0.0.1/cmens?a=%";
        LOGGER.debug("" + URI.create(uriString));
    }

    /**
     * Test create error uri.
     */
    @Test(expected = URIParseException.class)
    public void testCreateErrorUri(){
        URIUtil.create("://127.0.01/cmens");
    }

    /**
     * Test create null.
     */
    //****************************************************************************************
    @Test(expected = NullPointerException.class)
    public void testCreateNull(){
        URIUtil.create(null);
    }

    /**
     * Test create empty.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testCreateEmpty(){
        URIUtil.create("");
    }

    /**
     * Test create blank.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testCreateBlank(){
        URIUtil.create(" ");
    }
}

@@ -646,126 +646,90 @@
 ort 
-java.net.URI;%0A%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory
+static org.junit.Assert.assertEquals;%0A%0Aimport java.net.URI;%0A%0Aimport org.junit.Test
 ;%0A%0Ai
@@ -840,16 +840,22 @@
 Util
+Create
 Test.%0A *
  %0A *
@@ -850,17 +850,16 @@
 Test.%0A *
- 
 %0A * @aut
@@ -957,131 +957,8 @@
 t%7B%0A%0A
-    /** The Constant LOGGER. */%0A    private static final Logger LOGGER = LoggerFactory.getLogger(URIUtilCreateTest.class);%0A
     
@@ -1281,490 +1281,93 @@
 time
- DESC&search_page&areaid=2&server_id=63&act=search_browse&equip_type_ids&search_text=%E6%96%A9%E5%A6%96%E5%89%91%22;%0A        value = %22http://xy2.cbg.163.com/cgi-bin/equipquery.py?server_name=%E9%A3%8E%E8%8A%B1%E9%9B%AA%E6%9C%88&query_order=selling_time%22;%0A        URI uri = URIUtil.create(value);%0A        LOGGER.debug(%22%7B%7D%22, uri.toString());%0A    %7D%0A%0A    /**%0A     * Test create3.%0A     */%0A    @Test%0A    @Ignore%0A    public void testCreate3()%7B%0A        String uriString = %22http://127.0.0.1/cmens?a=%25%22;%0A        LOGGER.debug(%22%22 + URI.create(uri
+%22;%0A        URI uri = URIUtil.create(value);%0A        assertEquals(value, uri.to
 String
+(
 ));%0A

add URIUtilCreateTest fix #458