Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Add test for ContainerConfig deserialization without nullables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidxia committed Nov 14, 2017
1 parent f33eae9 commit 580313c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
package com.spotify.docker.client.messages;

import static com.spotify.docker.FixtureUtil.fixture;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.spotify.docker.client.ObjectMapperProvider;
Expand All @@ -46,4 +49,18 @@ public void test1_29() throws Exception {
objectMapper.readValue(fixture("fixtures/1.29/containerConfig.json"), ContainerConfig.class);
}

@Test
public void test1_29_WithoutNullables() throws Exception {
final ContainerConfig config = objectMapper.readValue(
fixture("fixtures/1.29/containerConfigWithoutNullables.json"), ContainerConfig.class);
assertThat(config.portSpecs(), is(nullValue()));
assertThat(config.exposedPorts(), is(nullValue()));
assertThat(config.env(), is(nullValue()));
assertThat(config.cmd(), is(nullValue()));
assertThat(config.entrypoint(), is(nullValue()));
assertThat(config.onBuild(), is(nullValue()));
assertThat(config.labels(), is(nullValue()));
assertThat(config.healthcheck(), is(nullValue()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Hostname": "string",
"Domainname": "string",
"User": "string",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"ArgsEscaped": true,
"Image": "string",
"Volumes": {
"additionalProperties": {}
},
"WorkingDir": "string",
"NetworkDisabled": true,
"MacAddress": "string",
"StopSignal": "SIGTERM",
"StopTimeout": 10,
"Shell": [
"string"
]
}

0 comments on commit 580313c

Please sign in to comment.