// Path: ngsi2-client/src/test/java/com/orange/ngsi2/Utils.java
// public class Utils {
// 
//     /**
//      * Common object mapper used for most tests with Java 8 support for Optional
//      */
//     public final static ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module())
//             .registerModule(new JavaTimeModule())
//             .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// 
//     /**
//      * Load a resource as an UTF-8 string
//      * @param name name of the resource
//      * @return the content of the resource
//      */
//     public static String loadResource(String name) {
//         try {
//             URL url = Utils.class.getClassLoader().getResource(name);
//             if (url == null) {
//                 return "";
//             }
//             return new String(Files.readAllBytes(Paths.get(url.toURI())), "UTF-8");
//         } catch (Exception e) {
//             return "";
//         }
//     }
// 
// }


import static org.junit.Assert.assertTrue;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.orange.ngsi2.Utils;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
/*
 * Copyright (C) 2016 Orange
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.orange.ngsi2.model;




/**
 * Tests for the Entity Type
 */
public class EntityTypeTest {

    private String jsonString = "{\n" +
            "  \"attrs\" : {\n" +
            "    \"temperature\" : {\n" +
            "      \"type\" : \"urn:phenomenum:temperature\"\n" +
            "    },\n" +
            "    \"humidity\" : {\n" +
            "      \"type\" : \"percentage\"\n" +
            "    },\n" +
            "    \"pressure\" : {\n" +
            "      \"type\" : \"null\"\n" +
            "    }\n" +
            "  },\n" +
            "  \"count\" : 7\n" +
            "}";

    @Test
    public void serializationEntityTypeTest() throws JsonProcessingException {
// Path: ngsi2-client/src/test/java/com/orange/ngsi2/Utils.java
// public class Utils {
// 
//     /**
//      * Common object mapper used for most tests with Java 8 support for Optional
//      */
//     public final static ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module())
//             .registerModule(new JavaTimeModule())
//             .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// 
//     /**
//      * Load a resource as an UTF-8 string
//      * @param name name of the resource
//      * @return the content of the resource
//      */
//     public static String loadResource(String name) {
//         try {
//             URL url = Utils.class.getClassLoader().getResource(name);
//             if (url == null) {
//                 return "";
//             }
//             return new String(Files.readAllBytes(Paths.get(url.toURI())), "UTF-8");
//         } catch (Exception e) {
//             return "";
//         }
//     }
// 
// }


// Path: ngsi2-client/src/test/java/com/orange/ngsi2/model/EntityTypeTest.java
import static org.junit.Assert.assertTrue;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.orange.ngsi2.Utils;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;

/*
 * Copyright (C) 2016 Orange
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.orange.ngsi2.model;




/**
 * Tests for the Entity Type
 */
public class EntityTypeTest {

    private String jsonString = "{\n" +
            "  \"attrs\" : {\n" +
            "    \"temperature\" : {\n" +
            "      \"type\" : \"urn:phenomenum:temperature\"\n" +
            "    },\n" +
            "    \"humidity\" : {\n" +
            "      \"type\" : \"percentage\"\n" +
            "    },\n" +
            "    \"pressure\" : {\n" +
            "      \"type\" : \"null\"\n" +
            "    }\n" +
            "  },\n" +
            "  \"count\" : 7\n" +
            "}";

    @Test
    public void serializationEntityTypeTest() throws JsonProcessingException {
        ObjectWriter writer = Utils.objectMapper.writer(new DefaultPrettyPrinter());