-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathHeaderUtilTest.java
64 lines (38 loc) · 1.26 KB
/
HeaderUtilTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package util;
import org.junit.Test;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
public class HeaderUtilTest {
@Test
public void url_분리() {
String header = "GET /index.html HTTP/1.1";
String url = HeaderUtil.getUriInHeader(header);
assertThat("/index.html", is(url));
}
@Test
public void url_파라메터_제거버전() {
String pullUrl = "/index.html?name=123&password=1234";
String url = HeaderUtil.getRealUrl(pullUrl);
assertThat("/index.html", is(url));
}
@Test
public void url_제거버전() {
String pullUrl = "/index.html?name=123&password=1234";
String url = HeaderUtil.getParamInUrl(pullUrl);
assertThat("name=123&password=1234", is(url));
}
@Test
public void url_제거버전2() {
String pullUrl = "/index.html";
String url = HeaderUtil.getParamInUrl(pullUrl);
assertThat("", is(url));
}
@Test
public void paramToMap() {
String pullUrl = "name=123&password=1234";
Map<String,String> map = HeaderUtil.paramToMap(pullUrl);
assertThat("123", is(map.get("name")));
assertThat("1234", is(map.get("password")));
}
}