Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
TestUriQueryProps.java
Go to the documentation of this file.
1package jau.test.net;
2
3import static jau.test.net.URIDumpUtil.showUri;
4
5import java.io.IOException;
6import java.net.URISyntaxException;
7
8import org.jau.net.Uri;
9import org.jau.net.UriQueryProps;
10import org.junit.Assert;
11import org.junit.FixMethodOrder;
12import org.junit.Test;
13import org.junit.runners.MethodSorters;
14
15import jau.test.junit.util.JunitTracer;
16
17@FixMethodOrder(MethodSorters.NAME_ASCENDING)
18public class TestUriQueryProps extends JunitTracer {
19
20 @Test
21 public void test() throws IOException, URISyntaxException {
22 final String SCHEME = "camera";
23 final String HOST = "somewhere";
24 final String PATH = "0";
25 final String[] args = new String[] {
26 SCHEME+"://"+HOST+"/"+PATH,
27 SCHEME+"://"+HOST+"/"+PATH+"?p1=1",
28 };
29 for(int i=0; i<args.length-1; i+=2) {
30 final String uri_s0 = args[i];
31 final String uri_s1 = args[i+1];
32 final Uri uri0 = Uri.cast(uri_s0);
33 final Uri uri1 = Uri.cast(uri_s1);
34 showUri(uri0);
35 showUri(uri1);
36 final UriQueryProps data = UriQueryProps.create(uri1, ';');
37 if(null == data) {
38 System.err.println("Error: NULL: <"+uri_s1+"> -> "+uri1+" -> NULL");
39 } else {
40 final Uri uri1T = data.appendQuery(uri0);
41 showUri(uri1T);
42 Assert.assertEquals(uri1, uri1T);
43 }
44 }
45 }
46 public static void main(final String args[]) throws IOException {
47 final String tstname = TestUriQueryProps.class.getName();
48 org.junit.runner.JUnitCore.main(tstname);
49 }
50}
static void main(final String args[])