Project

General

Profile

« Previous | Next » 

Revision 2720ea2c

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/UriUtilsTest.java
8 8
import java.util.ArrayList;
9 9
import java.util.List;
10 10

  
11
import org.junit.Assert;
12

  
13 11
import org.apache.http.HttpException;
14 12
import org.apache.http.NameValuePair;
15 13
import org.apache.http.client.ClientProtocolException;
16 14
import org.apache.http.message.BasicNameValuePair;
17 15
import org.apache.log4j.Logger;
18
import org.junit.Before;
19
import org.junit.BeforeClass;
16
import org.junit.Assert;
20 17
import org.junit.Test;
21 18

  
22 19
public class UriUtilsTest {
23
    private static final Logger logger = Logger.getLogger(UriUtilsTest.class);
24

  
25
    @BeforeClass
26
    public static void setUpBeforeClass() throws Exception {
27
    }
28 20

  
29
    @Before
30
    public void setUp() throws Exception {
31
    }
21
    private static final Logger logger = Logger.getLogger(UriUtilsTest.class);
32 22

  
33 23
//********************* TESTS **********************************************/
34 24

  
......
40 30
            String fragment = "frag";
41 31
            URI uri = UriUtils.createUri(baseUrl, subPath, null, fragment);
42 32
            Assert.assertEquals("http://www.abc.de/fgh#frag", uri.toString());
43
            List<NameValuePair> qparams = new ArrayList<NameValuePair>(0);
33
            List<NameValuePair> qparams = new ArrayList<>(0);
44 34
            NameValuePair pair1 = new BasicNameValuePair("param1","value1");
45 35
            qparams.add(pair1);
46 36
            uri = UriUtils.createUri(baseUrl, subPath, qparams, fragment);
47 37
            Assert.assertEquals("http://www.abc.de/fgh?param1=value1#frag", uri.toString());
48 38

  
49 39
        } catch (MalformedURLException e) {
50
            e.printStackTrace();
51 40
            Assert.fail(e.getMessage());
52 41
        } catch (URISyntaxException e) {
53
            e.printStackTrace();
54 42
            Assert.fail(e.getMessage());
55 43
        }
56 44
    }
......
64 52
            logger.warn("Test: testGetResourceLength() skipped, since internet is not available");
65 53
        }
66 54
    }
67
    
55

  
68 56
    @Test
69 57
    public void testGetResourceLengthNull2() throws ClientProtocolException, IOException, HttpException{
70 58
        if(UriUtils.isInternetAvailable(null)){
71
        	URI uri;
72 59
			try {
73
				uri = new URI("http:/www.abc.de:8080/xyz");
60
				@SuppressWarnings("unused")
61
                URI uri = new URI("http:/www.abc.de:8080/xyz");
74 62
				System.out.println("  sdf");
75 63
//				Assert.assertEquals(9143, UriUtils.getResourceLength(uri, null));
76 64
			} catch (URISyntaxException e) {
77 65
				// TODO Auto-generated catch block
78 66
				e.printStackTrace();
79 67
			}
80
            
68

  
81 69
        } else {
82 70
            logger.warn("Test: testGetResourceLength() skipped, since internet is not available");
83 71
        }
84 72
    }
85
    
73

  
86 74
    @Test
87 75
    public void testGetResourceLengthMissingProtocol() throws ClientProtocolException, HttpException{
88 76
    	URI uri;
......
95 83
			Assert.assertNotNull(e.getMessage().equals(UriUtils.URI_IS_NOT_ABSOLUTE));
96 84
		}
97 85
    }
98
    
86

  
99 87
    @Test
100 88
    public void testGetResourceLengthUnknownProtocol() throws ClientProtocolException, HttpException{
101 89
    	URI uri;

Also available in: Unified diff