Search in sources :

Example 1 with TypedObject

use of com.github.davidmoten.odata.client.internal.TypedObject in project odata-client by davidmoten.

the class InlineParameterSyntaxTest method testInteger.

@Test
public void testInteger() {
    Map<String, TypedObject> parameters = new HashMap<>();
    parameters.put("name", new TypedObject("Edm.Int32", 123));
    assertEquals("(name=123)", encode(Serializer.INSTANCE, parameters));
}
Also used : TypedObject(com.github.davidmoten.odata.client.internal.TypedObject) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 2 with TypedObject

use of com.github.davidmoten.odata.client.internal.TypedObject in project odata-client by davidmoten.

the class InlineParameterSyntaxTest method testString.

@Test
public void testString() {
    Map<String, TypedObject> parameters = new HashMap<>();
    parameters.put("name", new TypedObject("Edm.String", "fred"));
    assertEquals("(name='fred')", encode(Serializer.INSTANCE, parameters));
}
Also used : TypedObject(com.github.davidmoten.odata.client.internal.TypedObject) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 3 with TypedObject

use of com.github.davidmoten.odata.client.internal.TypedObject in project odata-client by davidmoten.

the class InlineParameterSyntaxTest method testDate.

@Test
public void testDate() {
    OffsetDateTime t = OffsetDateTime.parse("2007-12-03T10:15:30+01:00");
    Map<String, TypedObject> parameters = new HashMap<>();
    parameters.put("name", new TypedObject("Edm.DateTimeOffset", t));
    assertEquals("(name=\"2007-12-03T10:15:30+01:00\")", encode(Serializer.INSTANCE, parameters));
}
Also used : TypedObject(com.github.davidmoten.odata.client.internal.TypedObject) OffsetDateTime(java.time.OffsetDateTime) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with TypedObject

use of com.github.davidmoten.odata.client.internal.TypedObject in project odata-client by davidmoten.

the class InlineParameterSyntaxTest method testBoolean.

@Test
public void testBoolean() {
    Map<String, TypedObject> parameters = new HashMap<>();
    parameters.put("name", new TypedObject("Edm.Boolean", false));
    assertEquals("(name=false)", encode(Serializer.INSTANCE, parameters));
}
Also used : TypedObject(com.github.davidmoten.odata.client.internal.TypedObject) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

TypedObject (com.github.davidmoten.odata.client.internal.TypedObject)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 OffsetDateTime (java.time.OffsetDateTime)1