Skip to content

Commit 8409685

Browse files
committed
more test clean up
1 parent 4a61265 commit 8409685

File tree

9 files changed

+41
-42
lines changed

9 files changed

+41
-42
lines changed

client/src/test/java/org/asynchttpclient/BasicHttpTest.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.net.HttpURLConnection;
3232
import java.net.URL;
3333
import java.net.UnknownHostException;
34-
import java.nio.channels.UnresolvedAddressException;
3534
import java.util.Arrays;
3635
import java.util.HashMap;
3736
import java.util.List;
@@ -346,7 +345,7 @@ public void onThrowable(Throwable t) {
346345
}
347346
}
348347

349-
@Test(groups = { "online", "async" }, expectedExceptions = { NullPointerException.class })
348+
@Test(groups = "online", expectedExceptions = NullPointerException.class)
350349
public void asyncNullSchemeTest() throws Exception {
351350
try (AsyncHttpClient client = asyncHttpClient()) {
352351
client.prepareGet("www.sun.com").execute();
@@ -743,7 +742,7 @@ public Response onCompleted(Response response) throws Exception {
743742
}
744743
}
745744

746-
@Test(groups = "standalone", expectedExceptions = { CancellationException.class })
745+
@Test(groups = "standalone", expectedExceptions = CancellationException.class)
747746
public void asyncDoPostDelayCancelTest() throws Exception {
748747
try (AsyncHttpClient client = asyncHttpClient()) {
749748
HttpHeaders h = new DefaultHttpHeaders();
@@ -931,7 +930,7 @@ public void onThrowable(Throwable t) {
931930
}
932931
}
933932

934-
@Test(groups = { "online", "async" }, expectedExceptions = { ConnectException.class, UnresolvedAddressException.class, UnknownHostException.class })
933+
@Test(groups = "online", expectedExceptions = UnknownHostException.class)
935934
public void asyncConnectInvalidHandlerHost() throws Throwable {
936935
try (AsyncHttpClient client = asyncHttpClient()) {
937936

@@ -1013,7 +1012,7 @@ public void onThrowable(Throwable t) {
10131012
}
10141013
}
10151014

1016-
@Test(groups = { "standalone", "asyncAPI" })
1015+
@Test(groups = "standalone")
10171016
public void asyncAPIContentLenghtGETTest() throws Exception {
10181017
try (AsyncHttpClient client = asyncHttpClient()) {
10191018
// Use a l in case the assert fail
@@ -1042,7 +1041,7 @@ public void onThrowable(Throwable t) {
10421041
}
10431042
}
10441043

1045-
@Test(groups = { "standalone", "asyncAPI" })
1044+
@Test(groups = "standalone")
10461045
public void asyncAPIHandlerExceptionTest() throws Exception {
10471046
try (AsyncHttpClient client = asyncHttpClient()) {
10481047
// Use a l in case the assert fail
@@ -1178,7 +1177,7 @@ public Response onCompleted(Response response) throws Exception {
11781177
}
11791178
}
11801179

1181-
@Test(groups = { "online", "async" })
1180+
@Test(groups = "online")
11821181
public void asyncDoGetMaxRedirectTest() throws Exception {
11831182
try (AsyncHttpClient client = asyncHttpClient(config().setMaxRedirects(0).setFollowRedirect(true))) {
11841183
// Use a l in case the assert fail
@@ -1211,7 +1210,7 @@ public void onThrowable(Throwable t) {
12111210
}
12121211
}
12131212

1214-
@Test(groups = { "online", "async" })
1213+
@Test(groups = "online")
12151214
public void asyncDoGetNestedTest() throws Exception {
12161215
try (AsyncHttpClient client = asyncHttpClient()) {
12171216
// FIXME find a proper website that redirects the same number of
@@ -1252,23 +1251,23 @@ public void onThrowable(Throwable t) {
12521251
}
12531252
}
12541253

1255-
@Test(groups = { "online", "async" })
1254+
@Test(groups = "online")
12561255
public void asyncDoGetStreamAndBodyTest() throws Exception {
12571256
try (AsyncHttpClient client = asyncHttpClient()) {
12581257
Response response = client.prepareGet("http://www.lemonde.fr").execute().get();
12591258
assertEquals(response.getStatusCode(), 200);
12601259
}
12611260
}
12621261

1263-
@Test(groups = { "online", "async" })
1262+
@Test(groups = "online")
12641263
public void asyncUrlWithoutPathTest() throws Exception {
12651264
try (AsyncHttpClient client = asyncHttpClient()) {
12661265
Response response = client.prepareGet("http://www.lemonde.fr").execute().get();
12671266
assertEquals(response.getStatusCode(), 200);
12681267
}
12691268
}
12701269

1271-
@Test(groups = "async")
1270+
@Test(groups = "standalone")
12721271
public void optionsTest() throws Exception {
12731272
try (AsyncHttpClient client = asyncHttpClient()) {
12741273
Response response = client.prepareOptions(getTargetUrl()).execute().get();
@@ -1361,14 +1360,14 @@ public void getShouldAllowBody() throws IOException {
13611360
}
13621361
}
13631362

1364-
@Test(groups = "standalone", expectedExceptions = { NullPointerException.class })
1363+
@Test(groups = "standalone", expectedExceptions = NullPointerException.class)
13651364
public void invalidUri() throws Exception {
13661365
try (AsyncHttpClient client = asyncHttpClient()) {
13671366
client.prepareGet(String.format("http:127.0.0.1:%d/foo/test", port1)).build();
13681367
}
13691368
}
13701369

1371-
@Test(groups = "async")
1370+
@Test(groups = "standalone")
13721371
public void bodyAsByteTest() throws Exception {
13731372
try (AsyncHttpClient client = asyncHttpClient()) {
13741373
Response response = client.prepareGet(getTargetUrl()).execute().get();
@@ -1377,7 +1376,7 @@ public void bodyAsByteTest() throws Exception {
13771376
}
13781377
}
13791378

1380-
@Test(groups = "async")
1379+
@Test(groups = "standalone")
13811380
public void mirrorByteTest() throws Exception {
13821381
try (AsyncHttpClient client = asyncHttpClient()) {
13831382
Response response = client.preparePost(getTargetUrl()).setBody("MIRROR").execute().get();

client/src/test/java/org/asynchttpclient/channel/pool/ConnectionPoolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void testMaxTotalConnectionsException() throws IOException {
8888
}
8989
}
9090

91-
@Test(groups = { "standalone", "async" }, enabled = true, invocationCount = 10, alwaysRun = true)
91+
@Test(groups = "standalone", invocationCount = 10, alwaysRun = true)
9292
public void asyncDoGetKeepAliveHandlerTest_channelClosedDoesNotFail() throws Exception {
9393
try (AsyncHttpClient client = asyncHttpClient()) {
9494
// Use a l in case the assert fail

client/src/test/java/org/asynchttpclient/proxy/ProxyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void testBothProxies() throws IOException, ExecutionException, TimeoutExc
107107
}
108108
}
109109

110-
@Test(groups = "fast")
110+
@Test(groups = "standalone")
111111
public void testNonProxyHost() {
112112

113113
// // should avoid, it's in non-proxy hosts

client/src/test/java/org/asynchttpclient/request/body/multipart/MultipartBodyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
public class MultipartBodyTest {
3333

34-
@Test(groups = "fast")
34+
@Test(groups = "standalone")
3535
public void testBasics() throws IOException {
3636
final List<Part> parts = new ArrayList<>();
3737

client/src/test/java/org/asynchttpclient/util/TestUTF8UrlCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.testng.annotations.Test;
2121

2222
public class TestUTF8UrlCodec {
23-
@Test(groups = "fast")
23+
@Test(groups = "standalone")
2424
public void testBasics() {
2525
assertEquals(Utf8UrlEncoder.encodeQueryElement("foobar"), "foobar");
2626
assertEquals(Utf8UrlEncoder.encodeQueryElement("a&b"), "a%26b");

extras/registry/src/test/java/org/asynchttpclient/extras/registry/AbstractAsyncHttpClientFactoryTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ public void tearDown() throws Exception {
6767
* @throws Exception
6868
*/
6969
// ================================================================================================================
70-
@Test(groups = "fast")
70+
@Test(groups = "standalone")
7171
public void testGetAsyncHttpClient() throws Exception {
7272
try (AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory.getAsyncHttpClient()) {
7373
Assert.assertTrue(asyncHttpClient.getClass().equals(DefaultAsyncHttpClient.class));
7474
assertClientWorks(asyncHttpClient);
7575
}
7676
}
7777

78-
@Test(groups = "fast")
78+
@Test(groups = "standalone")
7979
public void testGetAsyncHttpClientConfig() throws Exception {
8080
try (AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory.getAsyncHttpClient()) {
8181
Assert.assertTrue(asyncHttpClient.getClass().equals(DefaultAsyncHttpClient.class));
8282
assertClientWorks(asyncHttpClient);
8383
}
8484
}
8585

86-
@Test(groups = "fast")
86+
@Test(groups = "standalone")
8787
public void testGetAsyncHttpClientProvider() throws Exception {
8888
try (AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory.getAsyncHttpClient()) {
8989
Assert.assertTrue(asyncHttpClient.getClass().equals(DefaultAsyncHttpClient.class));
@@ -98,22 +98,22 @@ public void testGetAsyncHttpClientProvider() throws Exception {
9898
* returned
9999
*/
100100
// ===================================================================================================================================
101-
@Test(groups = "fast")
101+
@Test(groups = "standalone")
102102
public void testFactoryWithSystemProperty() {
103103
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, TEST_CLIENT_CLASS_NAME);
104104
AsyncHttpClientConfigHelper.reloadProperties();
105105
Assert.assertTrue(AsyncHttpClientFactory.getAsyncHttpClient().getClass().equals(TestAsyncHttpClient.class));
106106
}
107107

108-
@Test(groups = "fast")
108+
@Test(groups = "standalone")
109109
public void testGetAsyncHttpClientConfigWithSystemProperty() {
110110
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, TEST_CLIENT_CLASS_NAME);
111111
AsyncHttpClientConfigHelper.reloadProperties();
112112
AsyncHttpClient asyncHttpClient = AsyncHttpClientFactory.getAsyncHttpClient();
113113
Assert.assertTrue(asyncHttpClient.getClass().equals(TestAsyncHttpClient.class));
114114
}
115115

116-
@Test(groups = "fast")
116+
@Test(groups = "standalone")
117117
public void testGetAsyncHttpClientProviderWithSystemProperty() {
118118
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, TEST_CLIENT_CLASS_NAME);
119119
AsyncHttpClientConfigHelper.reloadProperties();
@@ -128,15 +128,15 @@ public void testGetAsyncHttpClientProviderWithSystemProperty() {
128128
* AsyncHttpClientException is thrown.
129129
*/
130130
// ===================================================================================================================================
131-
@Test(groups = "fast", expectedExceptions = BadAsyncHttpClientException.class)
131+
@Test(groups = "standalone", expectedExceptions = BadAsyncHttpClientException.class)
132132
public void testFactoryWithBadAsyncHttpClient() {
133133
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, BAD_CLIENT_CLASS_NAME);
134134
AsyncHttpClientConfigHelper.reloadProperties();
135135
AsyncHttpClientFactory.getAsyncHttpClient();
136136
Assert.fail("BadAsyncHttpClientException should have been thrown before this point");
137137
}
138138

139-
@Test(groups = "fast")
139+
@Test(groups = "standalone")
140140
public void testGetAsyncHttpClientConfigWithBadAsyncHttpClient() {
141141
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, BAD_CLIENT_CLASS_NAME);
142142
AsyncHttpClientConfigHelper.reloadProperties();
@@ -148,7 +148,7 @@ public void testGetAsyncHttpClientConfigWithBadAsyncHttpClient() {
148148
//Assert.fail("AsyncHttpClientImplException should have been thrown before this point");
149149
}
150150

151-
@Test(groups = "fast")
151+
@Test(groups = "standalone")
152152
public void testGetAsyncHttpClientProviderWithBadAsyncHttpClient() {
153153
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, BAD_CLIENT_CLASS_NAME);
154154
AsyncHttpClientConfigHelper.reloadProperties();
@@ -166,7 +166,7 @@ public void testGetAsyncHttpClientProviderWithBadAsyncHttpClient() {
166166
* If the system property exists instantiate the class else if the class is
167167
* not found throw an AsyncHttpClientException.
168168
*/
169-
@Test(groups = "fast", expectedExceptions = AsyncHttpClientImplException.class)
169+
@Test(groups = "standalone", expectedExceptions = AsyncHttpClientImplException.class)
170170
public void testFactoryWithNonExistentAsyncHttpClient() {
171171
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, NON_EXISTENT_CLIENT_CLASS_NAME);
172172
AsyncHttpClientConfigHelper.reloadProperties();
@@ -178,7 +178,7 @@ public void testFactoryWithNonExistentAsyncHttpClient() {
178178
* If property is specified but the class can’t be created or found for any
179179
* reason subsequent calls should throw an AsyncClientException.
180180
*/
181-
@Test(groups = "fast", expectedExceptions = AsyncHttpClientImplException.class)
181+
@Test(groups = "standalone", expectedExceptions = AsyncHttpClientImplException.class)
182182
public void testRepeatedCallsToBadAsyncHttpClient() {
183183
boolean exceptionCaught = false;
184184
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY, NON_EXISTENT_CLIENT_CLASS_NAME);

extras/registry/src/test/java/org/asynchttpclient/extras/registry/AsyncHttpClientRegistryTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ public void tearDown() {
4848
System.clearProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_IMPL_SYSTEM_PROPERTY);
4949
}
5050

51-
@Test(groups = "fast")
51+
@Test(groups = "standalone")
5252
public void testGetAndRegister() {
5353
AsyncHttpClient ahc = AsyncHttpClientFactory.getAsyncHttpClient();
5454
Assert.assertNull(AsyncHttpClientRegistryImpl.getInstance().get(TEST_AHC));
5555
Assert.assertNull(AsyncHttpClientRegistryImpl.getInstance().addOrReplace(TEST_AHC, ahc));
5656
Assert.assertNotNull(AsyncHttpClientRegistryImpl.getInstance().get(TEST_AHC));
5757
}
5858

59-
@Test(groups = "fast")
59+
@Test(groups = "standalone")
6060
public void testDeRegister() {
6161
AsyncHttpClient ahc = AsyncHttpClientFactory.getAsyncHttpClient();
6262
Assert.assertFalse(AsyncHttpClientRegistryImpl.getInstance().unregister(TEST_AHC));
@@ -65,7 +65,7 @@ public void testDeRegister() {
6565
Assert.assertNull(AsyncHttpClientRegistryImpl.getInstance().get(TEST_AHC));
6666
}
6767

68-
@Test(groups = "fast")
68+
@Test(groups = "standalone")
6969
public void testRegisterIfNew() {
7070
AsyncHttpClient ahc = AsyncHttpClientFactory.getAsyncHttpClient();
7171
AsyncHttpClient ahc2 = AsyncHttpClientFactory.getAsyncHttpClient();
@@ -78,7 +78,7 @@ public void testRegisterIfNew() {
7878
Assert.assertTrue(AsyncHttpClientRegistryImpl.getInstance().get(TEST_AHC + 1) == ahc);
7979
}
8080

81-
@Test(groups = "fast")
81+
@Test(groups = "standalone")
8282
public void testClearAllInstances() {
8383
AsyncHttpClient ahc = AsyncHttpClientFactory.getAsyncHttpClient();
8484
AsyncHttpClient ahc2 = AsyncHttpClientFactory.getAsyncHttpClient();
@@ -94,22 +94,22 @@ public void testClearAllInstances() {
9494
Assert.assertNull(AsyncHttpClientRegistryImpl.getInstance().get(TEST_AHC + 3));
9595
}
9696

97-
@Test(groups = "fast")
97+
@Test(groups = "standalone")
9898
public void testCustomAsyncHttpClientRegistry() {
9999
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_REGISTRY_SYSTEM_PROPERTY, TestAsyncHttpClientRegistry.class.getName());
100100
AsyncHttpClientConfigHelper.reloadProperties();
101101
Assert.assertTrue(AsyncHttpClientRegistryImpl.getInstance() instanceof TestAsyncHttpClientRegistry);
102102
}
103103

104-
@Test(groups = "fast", expectedExceptions = AsyncHttpClientImplException.class)
104+
@Test(groups = "standalone", expectedExceptions = AsyncHttpClientImplException.class)
105105
public void testNonExistentAsyncHttpClientRegistry() {
106106
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_REGISTRY_SYSTEM_PROPERTY, AbstractAsyncHttpClientFactoryTest.NON_EXISTENT_CLIENT_CLASS_NAME);
107107
AsyncHttpClientConfigHelper.reloadProperties();
108108
AsyncHttpClientRegistryImpl.getInstance();
109109
Assert.fail("Should never have reached here");
110110
}
111111

112-
@Test(groups = "fast", expectedExceptions = AsyncHttpClientImplException.class)
112+
@Test(groups = "standalone", expectedExceptions = AsyncHttpClientImplException.class)
113113
public void testBadAsyncHttpClientRegistry() {
114114
System.setProperty(AsyncImplHelper.ASYNC_HTTP_CLIENT_REGISTRY_SYSTEM_PROPERTY, AbstractAsyncHttpClientFactoryTest.BAD_CLIENT_CLASS_NAME);
115115
AsyncHttpClientConfigHelper.reloadProperties();

extras/rxjava/src/test/java/org/asynchttpclient/extras/rxjava/AsyncHttpObservableTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
public class AsyncHttpObservableTest {
3030

31-
@Test(groups = "fast")
31+
@Test(groups = "standalone")
3232
public void testToObservableNoError() {
3333
final TestSubscriber<Response> tester = new TestSubscriber<>();
3434

@@ -53,7 +53,7 @@ public BoundRequestBuilder call() {
5353
}
5454
}
5555

56-
@Test(groups = "fast")
56+
@Test(groups = "standalone")
5757
public void testToObservableError() {
5858
final TestSubscriber<Response> tester = new TestSubscriber<>();
5959

@@ -78,7 +78,7 @@ public BoundRequestBuilder call() {
7878
}
7979
}
8080

81-
@Test(groups = "fast")
81+
@Test(groups = "standalone")
8282
public void testObserveNoError() {
8383
final TestSubscriber<Response> tester = new TestSubscriber<>();
8484

@@ -103,7 +103,7 @@ public BoundRequestBuilder call() {
103103
}
104104
}
105105

106-
@Test(groups = "fast")
106+
@Test(groups = "standalone")
107107
public void testObserveError() {
108108
final TestSubscriber<Response> tester = new TestSubscriber<>();
109109

@@ -128,7 +128,7 @@ public BoundRequestBuilder call() {
128128
}
129129
}
130130

131-
@Test(groups = "fast")
131+
@Test(groups = "standalone")
132132
public void testObserveMultiple() {
133133
final TestSubscriber<Response> tester = new TestSubscriber<>();
134134

extras/simple/src/test/java/org/asynchttpclient/extras/simple/SimpleAsyncHttpClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public void testCloseDerivedValidMaster() throws Exception {
265265
}
266266
}
267267

268-
@Test(groups = "standalone", expectedExceptions = { IllegalStateException.class })
268+
@Test(groups = "standalone", expectedExceptions = IllegalStateException.class)
269269
public void testCloseMasterInvalidDerived() throws Throwable {
270270
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setUrl(getTargetUrl()).build();
271271
SimpleAsyncHttpClient derived = client.derive().build();

0 commit comments

Comments
 (0)