|
|
@ -16,11 +16,16 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.web.util; |
|
|
|
package org.springframework.web.util; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
|
|
import java.io.ObjectInputStream; |
|
|
|
|
|
|
|
import java.io.ObjectOutputStream; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.equalTo; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
|
|
|
|
/** @author Arjen Poutsma */ |
|
|
|
/** @author Arjen Poutsma */ |
|
|
@ -75,4 +80,16 @@ public class UriComponentsTests { |
|
|
|
assertEquals("http://example.com/bar", uriComponents.normalize().toString()); |
|
|
|
assertEquals("http://example.com/bar", uriComponents.normalize().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void serializable() throws Exception { |
|
|
|
|
|
|
|
UriComponents uriComponents = UriComponentsBuilder.fromUriString( |
|
|
|
|
|
|
|
"http://example.com").path("/{foo}").query("bar={baz}").build(); |
|
|
|
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
|
|
|
|
|
|
|
ObjectOutputStream oos = new ObjectOutputStream(bos); |
|
|
|
|
|
|
|
oos.writeObject(uriComponents); |
|
|
|
|
|
|
|
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); |
|
|
|
|
|
|
|
UriComponents readObject = (UriComponents) ois.readObject(); |
|
|
|
|
|
|
|
assertThat(uriComponents.toString(), equalTo(readObject.toString())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|