// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/InvalidatedSyntaxException.java
// public class InvalidatedSyntaxException extends Ngsi2Exception {
// 
//     private final static String message = "The incoming request is invalid in this context. %s has a bad syntax.";
// 
//     public InvalidatedSyntaxException(Error error) {
//         super(error);
//     }
// 
//     public InvalidatedSyntaxException(String field) {
//         super("400", String.format(message, field), null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/GeoQuery.java
// public class GeoQuery {
// 
//     /**
//      * GeoQuery Enum model
//      */
//     public enum Relation {
//         near, coveredBy, intersects, equals, disjoint
//     }
// 
//     /**
//      * Modifier Enum model
//      */
//     public enum Modifier {
//         maxDistance, minDistance
//     }
// 
//     /**
//      * Geometry enum used for entities querying
//      */
//     public enum Geometry {
//         point, line, polygon, box
//     }
// 
//     private final Relation relation;
// 
//     private final Geometry geometry;
// 
//     private final List<Coordinate> coordinates;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final Modifier modifier;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final float distance;
// 
//     /**
//      * Default constructor
//      * @param relation relation to the geometry
//      * @param geometry geometry to match
//      * @param coordinates coordinates for the geometry
//      */
//     public GeoQuery(Relation relation, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = relation;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//         this.modifier = null;
//         this.distance = 0;
//     }
// 
//     /**
//      * Defines a near relation with modifier and distance
//      * @param modifier
//      * @param distance
//      */
//     public GeoQuery(Modifier modifier, float distance, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = Relation.near;
//         this.modifier = modifier;
//         this.distance = distance;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//     }
// 
//     public Relation getRelation() {
//         return relation;
//     }
// 
//     public Modifier getModifier() {
//         return modifier;
//     }
// 
//     public float getDistance() {
//         return distance;
//     }
// 
//     public Geometry getGeometry() {
//         return geometry;
//     }
// 
//     public List<Coordinate> getCoordinates() {
//         return coordinates;
//     }
// }


import com.orange.ngsi2.exception.InvalidatedSyntaxException;
import com.orange.ngsi2.model.GeoQuery;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.*;
/*
 * 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.server;



/**
 * Test class for Ngsi2ParsingHelper
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestConfiguration.class)
@WebAppConfiguration
public class Ngsi2ParsingHelperTest {

    @Test
    public void testParseTextValue() {
        assertEquals("hello world", Ngsi2ParsingHelper.parseTextValue("\"hello world\""));
        assertEquals(true, Ngsi2ParsingHelper.parseTextValue("true"));
        assertEquals(false, Ngsi2ParsingHelper.parseTextValue("false"));
        assertEquals(null, Ngsi2ParsingHelper.parseTextValue("null"));
        assertEquals(1, Ngsi2ParsingHelper.parseTextValue("1"));
        assertEquals(1.2f, Ngsi2ParsingHelper.parseTextValue("1.2"));
    }

    @Test
    public void testParseGeoQuery() {
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/exception/InvalidatedSyntaxException.java
// public class InvalidatedSyntaxException extends Ngsi2Exception {
// 
//     private final static String message = "The incoming request is invalid in this context. %s has a bad syntax.";
// 
//     public InvalidatedSyntaxException(Error error) {
//         super(error);
//     }
// 
//     public InvalidatedSyntaxException(String field) {
//         super("400", String.format(message, field), null);
//     }
// 
// }
// 
// Path: ngsi2-client/src/main/java/com/orange/ngsi2/model/GeoQuery.java
// public class GeoQuery {
// 
//     /**
//      * GeoQuery Enum model
//      */
//     public enum Relation {
//         near, coveredBy, intersects, equals, disjoint
//     }
// 
//     /**
//      * Modifier Enum model
//      */
//     public enum Modifier {
//         maxDistance, minDistance
//     }
// 
//     /**
//      * Geometry enum used for entities querying
//      */
//     public enum Geometry {
//         point, line, polygon, box
//     }
// 
//     private final Relation relation;
// 
//     private final Geometry geometry;
// 
//     private final List<Coordinate> coordinates;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final Modifier modifier;
// 
//     /**
//      * Defined only for a near relation
//      */
//     private final float distance;
// 
//     /**
//      * Default constructor
//      * @param relation relation to the geometry
//      * @param geometry geometry to match
//      * @param coordinates coordinates for the geometry
//      */
//     public GeoQuery(Relation relation, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = relation;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//         this.modifier = null;
//         this.distance = 0;
//     }
// 
//     /**
//      * Defines a near relation with modifier and distance
//      * @param modifier
//      * @param distance
//      */
//     public GeoQuery(Modifier modifier, float distance, Geometry geometry, List<Coordinate> coordinates) {
//         this.relation = Relation.near;
//         this.modifier = modifier;
//         this.distance = distance;
//         this.geometry = geometry;
//         this.coordinates = coordinates;
//     }
// 
//     public Relation getRelation() {
//         return relation;
//     }
// 
//     public Modifier getModifier() {
//         return modifier;
//     }
// 
//     public float getDistance() {
//         return distance;
//     }
// 
//     public Geometry getGeometry() {
//         return geometry;
//     }
// 
//     public List<Coordinate> getCoordinates() {
//         return coordinates;
//     }
// }


// Path: ngsi2-server/src/test/java/com/orange/ngsi2/server/Ngsi2ParsingHelperTest.java
import com.orange.ngsi2.exception.InvalidatedSyntaxException;
import com.orange.ngsi2.model.GeoQuery;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.*;

/*
 * 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.server;



/**
 * Test class for Ngsi2ParsingHelper
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestConfiguration.class)
@WebAppConfiguration
public class Ngsi2ParsingHelperTest {

    @Test
    public void testParseTextValue() {
        assertEquals("hello world", Ngsi2ParsingHelper.parseTextValue("\"hello world\""));
        assertEquals(true, Ngsi2ParsingHelper.parseTextValue("true"));
        assertEquals(false, Ngsi2ParsingHelper.parseTextValue("false"));
        assertEquals(null, Ngsi2ParsingHelper.parseTextValue("null"));
        assertEquals(1, Ngsi2ParsingHelper.parseTextValue("1"));
        assertEquals(1.2f, Ngsi2ParsingHelper.parseTextValue("1.2"));
    }

    @Test
    public void testParseGeoQuery() {
        GeoQuery geoQuery = Ngsi2ParsingHelper.parseGeoQuery("near;minDistance:23.3", "point", "12.3,14.2");