Package com.vercer.engine.persist

Source Code of com.vercer.engine.persist.EnumSetTest$EnumContainer

package com.vercer.engine.persist;

import java.util.EnumSet;

import org.junit.Assert;
import org.junit.Test;

import com.google.appengine.api.datastore.Key;
import com.vercer.engine.persist.annotation.AnnotationObjectDatastore;

public class EnumSetTest extends LocalDatastoreTestCase
{
  public enum MyEnum { HELLO, THERE };
 
  public static class EnumContainer
  {
    EnumSet<MyEnum> theEnumSet;
  }
 
  @Test
  public void testStoreLoadEnumSet()
  {
    EnumSet<MyEnum> myEnums = EnumSet.allOf(MyEnum.class);
    EnumContainer container = new EnumContainer();
    container.theEnumSet = myEnums;
   
    ObjectDatastore datastore = new AnnotationObjectDatastore();
    Key key = datastore.store(container);
   
    datastore.disassociateAll();
   
    EnumContainer loaded = datastore.load(key);
   
    Assert.assertTrue(loaded.theEnumSet instanceof EnumSet<?>);
    Assert.assertTrue(loaded.theEnumSet.size() == 2);
  }
}
TOP

Related Classes of com.vercer.engine.persist.EnumSetTest$EnumContainer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.