|
2 | 2 |
|
3 | 3 | import static org.hamcrest.MatcherAssert.assertThat; |
4 | 4 | import static org.hamcrest.Matchers.equalTo; |
| 5 | +import static org.hamcrest.core.Is.is; |
5 | 6 | import static org.testng.Assert.assertEquals; |
| 7 | +import static org.testng.Assert.assertFalse; |
| 8 | +import static org.testng.Assert.assertTrue; |
6 | 9 |
|
| 10 | +import java.lang.reflect.Field; |
7 | 11 | import java.net.URI; |
8 | 12 | import java.util.Collections; |
9 | 13 | import java.util.HashMap; |
@@ -176,4 +180,33 @@ public void testUnixHostScheme() throws Exception { |
176 | 180 | new DockerClientConfig(URI.create("unix://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail", |
177 | 181 | null, false); |
178 | 182 | } |
| 183 | + |
| 184 | + @Test |
| 185 | + public void withDockerTlsVerify() throws Exception { |
| 186 | + DockerClientConfig.DockerClientConfigBuilder builder = new DockerClientConfig.DockerClientConfigBuilder(); |
| 187 | + Field field = builder.getClass().getDeclaredField("dockerTlsVerify"); |
| 188 | + field.setAccessible(true); |
| 189 | + |
| 190 | + builder.withDockerTlsVerify(""); |
| 191 | + assertThat(field.getBoolean(builder), is(false)); |
| 192 | + |
| 193 | + builder.withDockerTlsVerify("false"); |
| 194 | + assertThat(field.getBoolean(builder), is(false)); |
| 195 | + |
| 196 | + builder.withDockerTlsVerify("FALSE"); |
| 197 | + assertThat(field.getBoolean(builder), is(false)); |
| 198 | + |
| 199 | + builder.withDockerTlsVerify("true"); |
| 200 | + assertThat(field.getBoolean(builder), is(true)); |
| 201 | + |
| 202 | + builder.withDockerTlsVerify("TRUE"); |
| 203 | + assertThat(field.getBoolean(builder), is(true)); |
| 204 | + |
| 205 | + builder.withDockerTlsVerify("0"); |
| 206 | + assertThat(field.getBoolean(builder), is(false)); |
| 207 | + |
| 208 | + builder.withDockerTlsVerify("1"); |
| 209 | + assertThat(field.getBoolean(builder), is(true)); |
| 210 | + } |
| 211 | + |
179 | 212 | } |
0 commit comments