diff options
Diffstat (limited to 'keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java')
-rw-r--r-- | keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java index e79394e..246fa75 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.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,34 +34,18 @@ public class TenantsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenants\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]," + EOL - + " \"tenants_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"tenants\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " } ]," + EOL + + " \"tenants_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + 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 { @@ -79,17 +61,18 @@ public class TenantsTest { public void testMethods() throws Exception { Tenants tenants = objectMapper.readValue(JSON_FULL, Tenants.class); tenants.toString(); - + List<Link> links = tenants.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + List<Tenant> list = tenants.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Tenant x : tenants) { + for (@SuppressWarnings("unused") + Tenant x : tenants) { ++cnt; } Assert.assertEquals(2, cnt); |