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 package org.apache.http.impl.client;
28
29 import org.apache.http.client.methods.HttpDelete;
30 import org.apache.http.client.methods.HttpGet;
31 import org.apache.http.client.methods.HttpHead;
32 import org.apache.http.client.methods.HttpPost;
33 import org.apache.http.client.methods.HttpPut;
34 import org.junit.Assert;
35 import org.junit.Test;
36
37 public class TestLaxRedirectStrategy {
38
39 @Test
40 public void testIsRedirectable() {
41 assertLaxRedirectable(new LaxRedirectStrategy());
42 }
43
44 @Test
45 public void testInstance() {
46 assertLaxRedirectable(LaxRedirectStrategy.INSTANCE);
47 }
48
49 private void assertLaxRedirectable(final LaxRedirectStrategy redirectStrategy) {
50 Assert.assertTrue(redirectStrategy.isRedirectable(HttpGet.METHOD_NAME));
51 Assert.assertTrue(redirectStrategy.isRedirectable(HttpHead.METHOD_NAME));
52 Assert.assertFalse(redirectStrategy.isRedirectable(HttpPut.METHOD_NAME));
53 Assert.assertTrue(redirectStrategy.isRedirectable(HttpPost.METHOD_NAME));
54 Assert.assertTrue(redirectStrategy.isRedirectable(HttpDelete.METHOD_NAME));
55 }
56 }