// 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.ObjectWriter;
import com.orange.ngsi2.Utils;
import org.junit.Test;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Instant;
import java.util.*;
import static org.junit.Assert.assertEquals;
            "      \"id\" : \"Bcn_Welt\",\n" +
            "      \"type\" : \"Room\"\n" +
            "    } ],\n" +
            "    \"condition\" : {\n" +
            "      \"attributes\" : [ \"temperature\" ],\n" +
            "      \"expression\" : {\n" +
            "        \"q\" : \"temperature>40\"\n" +
            "      }\n" +
            "    }\n" +
            "  },\n" +
            "  \"notification\" : {\n" +
            "    \"attributes\" : [ \"temperature\", \"humidity\" ],\n" +
            "    \"callback\" : \"http://localhost:1234\",\n" +
            "    \"headers\" : {\n" +
            "      \"X-MyHeader\" : \"foo\"\n" +
            "    },\n" +
            "    \"query\" : {\n" +
            "      \"authToken\" : \"bar\"\n" +
            "    },\n" +
            "    \"attrsFormat\" : \"keyValues\",\n" +
            "    \"throttling\" : 5,\n" +
            "    \"timesSent\" : 12,\n" +
            "    \"lastNotification\" : \"2015-10-05T16:00:00.100Z\"\n" +
            "  },\n" +
            "  \"expires\" : \"2016-04-05T14:00:00.200Z\",\n" +
            "  \"status\" : \"active\"\n" +
            "}";

    @Test
    public void serializationSubscriptionTest() throws JsonProcessingException, MalformedURLException {
// 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/SubscriptionTest.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.ObjectWriter;
import com.orange.ngsi2.Utils;
import org.junit.Test;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Instant;
import java.util.*;
import static org.junit.Assert.assertEquals;

            "      \"id\" : \"Bcn_Welt\",\n" +
            "      \"type\" : \"Room\"\n" +
            "    } ],\n" +
            "    \"condition\" : {\n" +
            "      \"attributes\" : [ \"temperature\" ],\n" +
            "      \"expression\" : {\n" +
            "        \"q\" : \"temperature>40\"\n" +
            "      }\n" +
            "    }\n" +
            "  },\n" +
            "  \"notification\" : {\n" +
            "    \"attributes\" : [ \"temperature\", \"humidity\" ],\n" +
            "    \"callback\" : \"http://localhost:1234\",\n" +
            "    \"headers\" : {\n" +
            "      \"X-MyHeader\" : \"foo\"\n" +
            "    },\n" +
            "    \"query\" : {\n" +
            "      \"authToken\" : \"bar\"\n" +
            "    },\n" +
            "    \"attrsFormat\" : \"keyValues\",\n" +
            "    \"throttling\" : 5,\n" +
            "    \"timesSent\" : 12,\n" +
            "    \"lastNotification\" : \"2015-10-05T16:00:00.100Z\"\n" +
            "  },\n" +
            "  \"expires\" : \"2016-04-05T14:00:00.200Z\",\n" +
            "  \"status\" : \"active\"\n" +
            "}";

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