forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVolumeBindsTest.java
More file actions
31 lines (24 loc) · 1013 Bytes
/
Copy pathVolumeBindsTest.java
File metadata and controls
31 lines (24 loc) · 1013 Bytes
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
package com.github.dockerjava.api.model;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.testng.annotations.Test;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class VolumeBindsTest {
@Test
public void t() throws IOException {
String s = "{\"/data\":\"/some/path\"}";
ObjectMapper objectMapper = new ObjectMapper();
VolumeBinds volumeBinds = objectMapper.readValue(s, VolumeBinds.class);
VolumeBind[] binds = volumeBinds.getBinds();
assertEquals(binds.length, 1);
assertEquals(binds[0].getHostPath(), "/some/path");
assertEquals(binds[0].getContainerPath(), "/data");
}
@Test(expectedExceptions = JsonMappingException.class)
public void t1() throws IOException {
String s = "{\"/data\": {} }";
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.readValue(s, VolumeBinds.class);
}
}