GlueGen: src/junit/com/jogamp/common/net/TestUriQueryProps.java Source File

GlueGen v2.6.0-rc-20250822 GlueGen, Native Binding Generator for Java™ (public API).

TestUriQueryProps.java
Go to the documentation of this file.
1package com.jogamp.common.net;
2
3import static com.jogamp.common.net.URIDumpUtil.showUri;
4
5import java.io.IOException;
6import java.net.URISyntaxException;
7
8import org.junit.Assert;
9import org.junit.Test;
10
11import com.jogamp.junit.util.SingletonJunitCase;
12
13import org.junit.FixMethodOrder;
14import org.junit.runners.MethodSorters;
15
16@FixMethodOrder(MethodSorters.NAME_ASCENDING)
17public class TestUriQueryProps extends SingletonJunitCase {
18
19 @Test
20 public void test() throws IOException, URISyntaxException {
21 final String SCHEME = "camera";
22 final String HOST = "somewhere";
23 final String PATH = "0";
24 final String[] args = new String[] {
25 SCHEME+"://"+HOST+"/"+PATH,
26 SCHEME+"://"+HOST+"/"+PATH+"?p1=1",
27 };
28 for(int i=0; i<args.length-1; i+=2) {
29 final String uri_s0 = args[i];
30 final String uri_s1 = args[i+1];
31 final Uri uri0 = Uri.cast(uri_s0);
32 final Uri uri1 = Uri.cast(uri_s1);
33 showUri(uri0);
34 showUri(uri1);
35 final UriQueryProps data = UriQueryProps.create(uri1, ';');
36 if(null == data) {
37 System.err.println("Error: NULL: <"+uri_s1+"> -> "+uri1+" -> NULL");
38 } else {
39 final Uri uri1T = data.appendQuery(uri0);
40 showUri(uri1T);
41 Assert.assertEquals(uri1, uri1T);
42 }
43 }
44 }
45 public static void main(final String args[]) throws IOException {
46 final String tstname = TestUriQueryProps.class.getName();
47 org.junit.runner.JUnitCore.main(tstname);
48 }
49}
com.jogamp.common.net.TestUriQueryProps
Definition: TestUriQueryProps.java:17
com.jogamp.common.net.TestUriQueryProps.main
static void main(final String args[])
Definition: TestUriQueryProps.java:45
com.jogamp.common.net.TestUriQueryProps.test
void test()
Definition: TestUriQueryProps.java:20
com.jogamp.common.net.UriQueryProps
Helper class to process URI's query, handled as properties.
Definition: UriQueryProps.java:51
com.jogamp.common.net.UriQueryProps.appendQuery
final Uri.Encoded appendQuery(Uri.Encoded baseQuery)
Definition: UriQueryProps.java:66
com.jogamp.common.net.UriQueryProps.create
static final UriQueryProps create(final Uri uri, final char querySeparator)
Definition: UriQueryProps.java:104
com.jogamp.common.net.Uri
This class implements an immutable Uri as defined by RFC 2396.
Definition: Uri.java:160
com.jogamp.common.net.Uri.cast
static Uri cast(final String encodedUri)
Casts the given encoded String to a new Encoded instance used to create the resulting Uri instance vi...
Definition: Uri.java:1068
com.jogamp.junit.util.SingletonJunitCase
Definition: SingletonJunitCase.java:39