Search in sources :

Example 6 with WrappedValueImpl

use of com.google.appengine.api.datastore.Entity.WrappedValueImpl in project appengine-java-standard by GoogleCloudPlatform.

the class EntityTest method testSetIndexedProperty.

@Test
public void testSetIndexedProperty() {
    Entity entity = new Entity("foo");
    IllegalArgumentException e1 = assertThrows(IllegalArgumentException.class, () -> entity.setIndexedProperty("prop", new Text("text")));
    assertThat(e1).hasMessageThat().contains("is not indexable");
    IllegalArgumentException e2 = assertThrows(IllegalArgumentException.class, () -> entity.setIndexedProperty("prop", ImmutableList.of(1L, new Blob(new byte[] { 1 }))));
    assertThat(e2).hasMessageThat().contains("is not indexable");
    entity.setIndexedProperty("prop", new EmbeddedEntity());
    WrappedValueImpl wrappedValue = (WrappedValueImpl) entity.getPropertyMap().get("prop");
    assertThat(wrappedValue.isIndexed()).isTrue();
    assertThat(wrappedValue.getForceIndexedEmbeddedEntity()).isTrue();
}
Also used : WrappedValueImpl(com.google.appengine.api.datastore.Entity.WrappedValueImpl) Test(org.junit.Test)

Aggregations

WrappedValueImpl (com.google.appengine.api.datastore.Entity.WrappedValueImpl)6 UnindexedValue (com.google.appengine.api.datastore.Entity.UnindexedValue)3 ArrayList (java.util.ArrayList)3 WrappedValue (com.google.appengine.api.datastore.Entity.WrappedValue)2 Test (org.junit.Test)2 EqualsTester (com.google.common.testing.EqualsTester)1 ArrayValue (com.google.datastore.v1.ArrayValue)1 Value (com.google.datastore.v1.Value)1 ByteString (com.google.protobuf.ByteString)1 NullValue (com.google.protobuf.NullValue)1 PropertyValue (com.google.storage.onestore.v3.OnestoreEntity.PropertyValue)1 ReferenceValue (com.google.storage.onestore.v3.OnestoreEntity.PropertyValue.ReferenceValue)1 UserValue (com.google.storage.onestore.v3.OnestoreEntity.PropertyValue.UserValue)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Nullable (org.checkerframework.checker.nullness.qual.Nullable)1