diff options
Diffstat (limited to 'nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java')
-rw-r--r-- | nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java index 514ea22..4cc2a44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java @@ -24,10 +24,8 @@ 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 java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,32 +35,18 @@ public class ExtensionTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extension\" : {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extension\" : {" + EOL + " \"alias\" : \"alias\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .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(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,23 +62,23 @@ public class ExtensionTest { public void testMethods() throws Exception { Extension extension = objectMapper.readValue(JSON_FULL, Extension.class); extension.toString(); - + String name = extension.getName(); Assert.assertNotNull(name); - + String namespace = extension.getNamespace(); Assert.assertNotNull(namespace); - + String alias = extension.getAlias(); Assert.assertNotNull(alias); - + String description = extension.getDescription(); Assert.assertNotNull(description); - + List<Link> links = extension.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + Calendar updated = extension.getUpdated(); Assert.assertNotNull(updated); } |