Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 22dd069

Browse files
author
Dan Richelson
committed
Add proxy auth config tests
1 parent 6ce94df commit 22dd069

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/test/java/com/launchdarkly/client/LDConfigTest.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.net.Proxy;
77

88
import static org.junit.Assert.assertEquals;
9+
import static org.junit.Assert.assertNotNull;
910
import static org.junit.Assert.assertNull;
1011

1112
public class LDConfigTest {
@@ -40,6 +41,7 @@ public void testSocketTimeoutSpecifiedInMilliseconds() {
4041
public void testNoProxyConfigured() {
4142
LDConfig config = new LDConfig.Builder().build();
4243
assertNull(config.proxy);
44+
assertNull(config.proxyAuthenticator);
4345
}
4446

4547
@Test
@@ -62,6 +64,37 @@ public void testProxy() {
6264
assertEquals(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost2", 4444)), config.proxy);
6365
}
6466

67+
@Test
68+
public void testProxyAuth() {
69+
LDConfig config = new LDConfig.Builder()
70+
.proxyHost("localhost2")
71+
.proxyPort(4444)
72+
.proxyUsername("proxyUser")
73+
.proxyPassword("proxyPassword")
74+
.build();
75+
assertNotNull(config.proxy);
76+
assertNotNull(config.proxyAuthenticator);
77+
}
78+
79+
@Test
80+
public void testProxyAuthPartialConfig() {
81+
LDConfig config = new LDConfig.Builder()
82+
.proxyHost("localhost2")
83+
.proxyPort(4444)
84+
.proxyUsername("proxyUser")
85+
.build();
86+
assertNotNull(config.proxy);
87+
assertNull(config.proxyAuthenticator);
88+
89+
config = new LDConfig.Builder()
90+
.proxyHost("localhost2")
91+
.proxyPort(4444)
92+
.proxyPassword("proxyPassword")
93+
.build();
94+
assertNotNull(config.proxy);
95+
assertNull(config.proxyAuthenticator);
96+
}
97+
6598
@Test
6699
public void testMinimumPollingIntervalIsEnforcedProperly(){
67100
LDConfig config = new LDConfig.Builder().pollingIntervalMillis(10L).build();

0 commit comments

Comments
 (0)