package org.asynchttpclient; import static org.junit.Assert.*; import org.junit.Test; public class TestAsyncHttpClientConfig { @Test public void testConstructor() { AsyncHttpClientConfig config = new AsyncHttpClientConfig(); assertNotNull(config); } @Test public void testBuilderConstructor() { AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); AsyncHttpClientConfig config = builder.build(); assertNotNull(config); } private void buildTestBool(boolean allowPoolingConnection, boolean allowSslConnectionPool, boolean asyncConnectMode, boolean compressionEnabled, boolean redirectEnabled, boolean rfc6265CookieEncoding, boolean spdyEnabled, boolean strict302Handling, boolean useRawUrl, boolean useRelativeURIsWithSSLProxies) { AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); builder.setAllowPoolingConnection(allowPoolingConnection); builder.setAllowSslConnectionPool(allowSslConnectionPool); builder.setAsyncConnectMode(asyncConnectMode); builder.setCompressionEnabled(compressionEnabled); builder.setFollowRedirects(redirectEnabled); builder.setRfc6265CookieEncoding(rfc6265CookieEncoding); builder.setSpdyEnabled(spdyEnabled); builder.setStrict302Handling(strict302Handling); builder.setUseRawUrl(useRawUrl); builder.setUseRelativeURIsWithSSLProxies(useRelativeURIsWithSSLProxies); AsyncHttpClientConfig config = builder.build(); assertNotNull(config); assertTrue(config.allowPoolingConnection == allowPoolingConnection); assertTrue(config.allowSslConnectionPool == allowSslConnectionPool); assertTrue(config.asyncConnectMode == asyncConnectMode); assertTrue(config.compressionEnabled == compressionEnabled); assertTrue(config.redirectEnabled == redirectEnabled); assertTrue(config.rfc6265CookieEncoding == rfc6265CookieEncoding); assertTrue(config.spdyEnabled == spdyEnabled); assertTrue(config.strict302Handling == strict302Handling); assertTrue(config.useRawUrl == useRawUrl); assertTrue(config.useRelativeURIsWithSSLProxies == useRelativeURIsWithSSLProxies); } private void buildTestNum(int i) { buildTestBool((i & 1) == 0, (i & 2) == 0, (i & 4) == 0, (i & 8) == 0, (i & 16) == 0, (i & 32) == 0, (i & 64) == 0, (i & 128) == 0, (i & 256) == 0, (i & 512) == 0); } @Test public void testBuilderGeneric() { for (int i = 0; i < 1024; i++) { buildTestNum(i); } } }