diff options
Diffstat (limited to 'nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java')
-rw-r--r-- | nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java index 6fe182d..b3f32a3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.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.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,45 +34,22 @@ public class ExtensionsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extensions\" : [ {" + 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 - + " \"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 + " \"extensions\" : [ {" + 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 + + " \"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(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 { @@ -90,13 +65,14 @@ public class ExtensionsTest { public void testMethods() throws Exception { Extensions extensions = objectMapper.readValue(JSON_FULL, Extensions.class); extensions.toString(); - + List<Extension> list = extensions.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Extension x : extensions) { + for (@SuppressWarnings("unused") + Extension x : extensions) { ++cnt; } Assert.assertEquals(2, cnt); |