forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerClientImplTest.java
More file actions
41 lines (30 loc) · 1.25 KB
/
Copy pathDockerClientImplTest.java
File metadata and controls
41 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.github.dockerjava.core;
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.fail;
import java.net.URI;
import org.testng.annotations.Test;
public class DockerClientImplTest {
@Test
public void configuredInstanceAuthConfig() throws Exception {
// given a config with null serverAddress
DefaultDockerClientConfig dockerClientConfig = new DefaultDockerClientConfig(URI.create("tcp://foo"), null, null, null, "", "", "", null);
DockerClientImpl dockerClient = DockerClientImpl.getInstance(dockerClientConfig);
// when we get the auth config
try {
dockerClient.authConfig();
fail();
} catch (NullPointerException e) {
// then we get a NPE with expected message
assertEquals(e.getMessage(), "Configured serverAddress is null.");
}
}
@Test
public void defaultInstanceAuthConfig() throws Exception {
System.setProperty("user.home", "target/test-classes/someHomeDir");
// given a default client
DockerClientImpl dockerClient = DockerClientImpl.getInstance();
// when we get the auth config
dockerClient.authConfig();
// then we do not get an exception
}
}