SPR-5973: Cleaning it up

This commit is contained in:
Arjen Poutsma
2011-09-08 11:01:56 +00:00
parent 5f208936ec
commit b6c1e88e4a
4 changed files with 286 additions and 258 deletions

View File

@@ -19,9 +19,10 @@ package org.springframework.web.util;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -55,11 +56,11 @@ public class UriBuilderTests {
}
@Test
@Ignore("Working on it")
public void templateVarsVarArgs() throws URISyntaxException {
UriBuilder builder = UriBuilder.newInstance();
URI result = builder.scheme("http").host("example.com").path("{foo}").build("bar");
URI result = UriBuilder.fromPath("/{foo}/{bar}").build("baz", "qux");
URI expected = new URI("http://example.com/bar");
URI expected = new URI("http://example.com/baz/qux");
assertEquals("Invalid result URI", expected, result);
}
@@ -82,11 +83,11 @@ public class UriBuilderTests {
@Test
public void templateVarsMap() throws URISyntaxException {
Map<String, String> vars = Collections.singletonMap("foo", "bar");
UriBuilder builder = UriBuilder.newInstance();
URI result = builder.scheme("http").host("example.com").path("{foo}").build(vars);
URI expected = new URI("http://example.com/bar");
Map<String, String> vars = new HashMap<String, String>(2);
vars.put("bar", "qux");
vars.put("foo", "baz");
URI result = UriBuilder.fromPath("/{foo}/{bar}").build(vars);
URI expected = new URI("/baz/qux");
assertEquals("Invalid result URI", expected, result);
}