Skip to content

Commit 0f514b1

Browse files
author
Stephane Landelle
committed
Fix tests
1 parent 2565dd6 commit 0f514b1

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2014 AsyncHttpClient Project. All rights reserved.
3+
*
4+
* This program is licensed to you under the Apache License Version 2.0,
5+
* and you may not use this file except in compliance with the Apache License Version 2.0.
6+
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
7+
*
8+
* Unless required by applicable law or agreed to in writing,
9+
* software distributed under the Apache License Version 2.0 is distributed on an
10+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
12+
*/
13+
package org.asynchttpclient.util;
14+
15+
public final class StringUtils {
16+
17+
private static final ThreadLocal<StringBuilder> STRING_BUILDERS = new ThreadLocal<StringBuilder>() {
18+
protected StringBuilder initialValue() {
19+
return new StringBuilder(512);
20+
};
21+
};
22+
23+
/**
24+
* BEWARE: MUSN'T APPEND TO ITSELF!
25+
* @return a pooled StringBuilder
26+
*/
27+
public static StringBuilder stringBuilder() {
28+
StringBuilder sb = STRING_BUILDERS.get();
29+
sb.setLength(0);
30+
return sb;
31+
}
32+
33+
private StringUtils() {
34+
// unused
35+
}
36+
}

api/src/test/java/org/asynchttpclient/async/RemoteSiteTest.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,7 @@ public void testUrlRequestParametersEncoding() throws Exception {
195195
String requestUrl2 = URL + URLEncoder.encode(REQUEST_PARAM, UTF_8.name());
196196
logger.info(String.format("Executing request [%s] ...", requestUrl2));
197197
Response response = client.prepareGet(requestUrl2).execute().get();
198-
assertEquals(response.getStatusCode(), 301);
199-
} finally {
200-
client.close();
201-
}
202-
}
203-
204-
/**
205-
* See https://issues.sonatype.org/browse/AHC-61
206-
*
207-
* @throws Exception
208-
*/
209-
@Test(groups = { "online", "default_provider" })
210-
public void testAHC60() throws Exception {
211-
AsyncHttpClient client = getAsyncHttpClient(null);
212-
try {
213-
Response response = client.prepareGet("http://www.meetup.com/stackoverflow/Mountain-View-CA/").execute().get();
214-
assertEquals(response.getStatusCode(), 200);
198+
assertEquals(response.getStatusCode(), 302);
215199
} finally {
216200
client.close();
217201
}

0 commit comments

Comments
 (0)