urbanairship-core/src/test/java/com/urbanairship/analytics/CustomEventTest.java
@Test
    public void testPropertiesValues() throws JSONException {
        CustomEvent event = CustomEvent.newBuilder("event name")
                .addProperty("true_boolean", true)
                .addProperty("false_boolean", false)
                .addProperty("double", 1234567.498765)
                .addProperty("string", "some string value")
                .addProperty("int", Integer.MIN_VALUE)
                .addProperty("long", Long.MAX_VALUE)
                .addProperty("array", Arrays.asList("value", "another value"))
                .build();

        assertTrue(event.isValid());

        // Validate the custom properties
        EventTestUtils.validateNestedEventValue(event, "properties", "true_boolean", "true");
        EventTestUtils.validateNestedEventValue(event, "properties", "false_boolean", "false");
        EventTestUtils.validateNestedEventValue(event, "properties", "double", "1234567.498765");
        EventTestUtils.validateNestedEventValue(event, "properties", "string", "\"some string value\"");
        EventTestUtils.validateNestedEventValue(event, "properties", "int", "-2147483648");
        EventTestUtils.validateNestedEventValue(event, "properties", "long", "9223372036854775807");

        // Validate the custom String[] property
        JsonList array = event.getEventData().get("properties").getMap().get("array").getList();
        assertEquals(2, array.size());
        assertEquals("value", array.get(0).getString());
        assertEquals("another value", array.get(1).getString());
    }
/**
     * Test properties are all stringified except for arrays of Strings.
     */
Test properties are all stringified except for arrays of Strings.
Test properties are all stringified except for arrays of Strings .
@Test
    public void testPropertiesValues() throws JSONException {
        CustomEvent event = CustomEvent.newBuilder("event name")
                .addProperty("true_boolean", true)
                .addProperty("false_boolean", false)
                .addProperty("double", 1234567.498765)
                .addProperty("string", "some string value")
                .addProperty("int", Integer.MIN_VALUE)
                .addProperty("long", Long.MAX_VALUE)
                .addProperty("array", Arrays.asList("value", "another value"))
                .build();
        assertTrue(event.isValid());
        EventTestUtils.validateNestedEventValue(event, "properties", "true_boolean", "true");
        EventTestUtils.validateNestedEventValue(event, "properties", "false_boolean", "false");
        EventTestUtils.validateNestedEventValue(event, "properties", "double", "1234567.498765");
        EventTestUtils.validateNestedEventValue(event, "properties", "string", "\"some string value\"");
        EventTestUtils.validateNestedEventValue(event, "properties", "int", "-2147483648");
        EventTestUtils.validateNestedEventValue(event, "properties", "long", "9223372036854775807");
        JsonList array = event.getEventData().get("properties").getMap().get("array").getList();
        assertEquals(2, array.size());
        assertEquals("value", array.get(0).getString());
        assertEquals("another value", array.get(1).getString());
    }
@ Test public void testPropertiesValues ( ) throws JSONException { CustomEvent event = CustomEvent . newBuilder ( "event name" ) . addProperty ( "true_boolean" , true ) . addProperty ( "false_boolean" , false ) . addProperty ( "double" , 1234567.498765 ) . addProperty ( "string" , "some string value" ) . addProperty ( "int" , Integer . MIN_VALUE ) . addProperty ( "long" , Long . MAX_VALUE ) . addProperty ( "array" , Arrays . asList ( "value" , "another value" ) ) . build ( ) ; assertTrue ( event . isValid ( ) ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "true_boolean" , "true" ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "false_boolean" , "false" ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "double" , "1234567.498765" ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "string" , "\"some string value\"" ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "int" , "-2147483648" ) ; EventTestUtils . validateNestedEventValue ( event , "properties" , "long" , "9223372036854775807" ) ; JsonList array = event . getEventData ( ) . get ( "properties" ) . getMap ( ) . get ( "array" ) . getList ( ) ; assertEquals ( 2 , array . size ( ) ) ; assertEquals ( "value" , array . get ( 0 ) . getString ( ) ) ; assertEquals ( "another value" , array . get ( 1 ) . getString ( ) ) ; }
Test properties are all stringified except for arrays of Strings.
Test properties are all stringified except for arrays of Strings .
// Validate the custom properties // Validate the custom String[] property