Search in sources :

Example 96 with Value

use of com.google.api.ads.admanager.jaxws.v202205.Value in project firebase-android-sdk by firebase.

the class UserDataWriterTest method testConvertsLists.

@Test
public void testConvertsLists() {
    ArrayValue.Builder expectedArray = ArrayValue.newBuilder().addValues(wrap("value")).addValues(wrap(true));
    Value actual = wrap(asList("value", true));
    assertTrue(Values.equals(Value.newBuilder().setArrayValue(expectedArray).build(), actual));
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value) ArrayValue(com.google.firestore.v1.ArrayValue) ArrayValue(com.google.firestore.v1.ArrayValue) Test(org.junit.Test)

Example 97 with Value

use of com.google.api.ads.admanager.jaxws.v202205.Value in project firebase-android-sdk by firebase.

the class UserDataWriterTest method testConvertsDoubleValue.

@SuppressWarnings("UnnecessaryBoxing")
@Test
public void testConvertsDoubleValue() {
    List<Double> testCases = asList(Double.POSITIVE_INFINITY, -Double.MAX_VALUE, Double.valueOf(-Float.MAX_VALUE), Long.MIN_VALUE * 1.0, -1.1, Double.valueOf(-Float.MIN_VALUE), -Double.MIN_VALUE, -0.0, 0.0, Double.valueOf(Float.MIN_VALUE), Double.MIN_VALUE, Double.valueOf(Float.MIN_NORMAL), Double.MIN_NORMAL, Long.MAX_VALUE * 1.0, Double.valueOf(Float.MAX_VALUE), Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NaN);
    for (Double d : testCases) {
        Value value = wrap(d);
        assertValueType(Value.ValueTypeCase.DOUBLE_VALUE, value);
        Object convertedValue = convertValue(value);
        assertEquals(d, convertedValue);
    }
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value) ArrayValue(com.google.firestore.v1.ArrayValue) TestUtil.wrapObject(com.google.firebase.firestore.testutil.TestUtil.wrapObject) Test(org.junit.Test)

Example 98 with Value

use of com.google.api.ads.admanager.jaxws.v202205.Value in project firebase-android-sdk by firebase.

the class UserDataWriterTest method testConvertsLongValue.

@SuppressWarnings("UnnecessaryBoxing")
@Test
public void testConvertsLongValue() {
    List<Long> testCases = asList(Long.MIN_VALUE, Long.valueOf(Integer.MIN_VALUE), -1L, 0L, 1L, Long.valueOf(Integer.MAX_VALUE), Long.MAX_VALUE);
    for (Long l : testCases) {
        Value value = wrap(l);
        assertValueType(Value.ValueTypeCase.INTEGER_VALUE, value);
        Object convertedValue = convertValue(value);
        assertEquals(l, convertedValue);
    }
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value) ArrayValue(com.google.firestore.v1.ArrayValue) TestUtil.wrapObject(com.google.firebase.firestore.testutil.TestUtil.wrapObject) Test(org.junit.Test)

Example 99 with Value

use of com.google.api.ads.admanager.jaxws.v202205.Value in project firebase-android-sdk by firebase.

the class UserDataWriterTest method testConvertsIntegerValue.

@Test
public void testConvertsIntegerValue() {
    List<Integer> testCases = asList(Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE);
    for (Integer i : testCases) {
        Value value = wrap(i);
        assertValueType(Value.ValueTypeCase.INTEGER_VALUE, value);
        Object convertedValue = convertValue(value);
        assertEquals(i.longValue(), convertedValue);
    }
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value) ArrayValue(com.google.firestore.v1.ArrayValue) TestUtil.wrapObject(com.google.firebase.firestore.testutil.TestUtil.wrapObject) Test(org.junit.Test)

Example 100 with Value

use of com.google.api.ads.admanager.jaxws.v202205.Value in project firebase-android-sdk by firebase.

the class UserDataWriterTest method testConvertsStringValue.

@Test
public void testConvertsStringValue() {
    List<String> testCases = asList("", "foo");
    for (String s : testCases) {
        Value value = wrap(s);
        Object convertedValue = convertValue(value);
        assertEquals(s, convertedValue);
    }
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value) ArrayValue(com.google.firestore.v1.ArrayValue) TestUtil.wrapObject(com.google.firebase.firestore.testutil.TestUtil.wrapObject) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)126 Value (com.google.firestore.v1.Value)108 ArrayValue (com.google.firestore.v1.ArrayValue)73 LinkedHashSet (java.util.LinkedHashSet)71 ObjectValue (com.google.firebase.firestore.model.ObjectValue)53 NullValue (com.google.protobuf.NullValue)50 MapValue (com.google.firestore.v1.MapValue)47 ArrayList (java.util.ArrayList)30 HashMap (java.util.HashMap)24 Value (com.google.datastore.v1.Value)20 Map (java.util.Map)19 TableFieldSchema (com.google.api.services.bigquery.model.TableFieldSchema)17 List (java.util.List)17 Record (org.apache.avro.generic.GenericData.Record)16 SchemaAndRecord (org.apache.beam.sdk.io.gcp.bigquery.SchemaAndRecord)16 CoreMatchers.notNullValue (org.hamcrest.CoreMatchers.notNullValue)16 Set (java.util.Set)14 TestUtil.wrapObject (com.google.firebase.firestore.testutil.TestUtil.wrapObject)13 Nullable (androidx.annotation.Nullable)10 Value (com.google.privacy.dlp.v2.Value)9