diff options
Diffstat (limited to 'swift-model/src/test/java/com')
-rw-r--r-- | swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java | 22 | ||||
-rw-r--r-- | swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java | 36 |
2 files changed, 22 insertions, 36 deletions
diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java index 41d7f6e..d75d4ea 100644 --- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java +++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,12 @@ public class ContainerTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"count\" : 2," + EOL - + " \"bytes\" : 84" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"name\" : \"name\"," + EOL + " \"count\" : 2," + EOL + " \"bytes\" : 84" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,15 +54,15 @@ public class ContainerTest { public void testMethods() throws Exception { Container container = objectMapper.readValue(JSON_FULL, Container.class); container.toString(); - + Long bytesUsed = container.getBytesUsed(); Assert.assertNotNull(bytesUsed); container.setBytesUsed(bytesUsed); - + Integer objectCount = container.getObjectCount(); Assert.assertNotNull(objectCount); container.setObjectCount(objectCount); - + String name = container.getName(); Assert.assertNotNull(name); container.setName(name); diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java index 28d909a..b3a72ca 100644 --- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java +++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,20 +34,13 @@ public class ObjectTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subdir\" : \"subdir\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"hash\" : \"hash\"," + EOL - + " \"bytes\" : 82," + EOL - + " \"content_type\" : \"contenttype\"," + EOL - + " \"last_modified\" : 1488715200000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"subdir\" : \"subdir\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"hash\" : \"hash\"," + EOL + " \"bytes\" : 82," + EOL + " \"content_type\" : \"contenttype\"," + + EOL + " \"last_modified\" : 1488715200000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,29 +54,30 @@ public class ObjectTest { @Test public void testMethods() throws Exception { - com.woorea.openstack.swift.model.Object object = objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class); + com.woorea.openstack.swift.model.Object object = + objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class); object.toString(); - + String subdir = object.getSubdir(); Assert.assertNotNull(subdir); object.setSubdir(subdir); - + Calendar lastModified = object.getLastModified(); Assert.assertNotNull(lastModified); object.setLastModified(lastModified); - + int bytes = object.getBytes(); Assert.assertNotNull(bytes); object.setBytes(bytes); - + String name = object.getName(); Assert.assertNotNull(name); object.setName(name); - + String hash = object.getHash(); Assert.assertNotNull(hash); object.setHash(hash); - + String contentType = object.getContentType(); Assert.assertNotNull(contentType); object.setContentType(contentType); |