Package com.vercer.engine.persist

Source Code of com.vercer.engine.persist.AutoGeneratedIdTest$HasStringKey

package com.vercer.engine.persist;

import junit.framework.Assert;

import org.junit.Test;

import com.vercer.engine.persist.annotation.AnnotationObjectDatastore;
import com.vercer.engine.persist.annotation.Id;
import com.vercer.engine.persist.annotation.Key;

@SuppressWarnings("deprecation")
public class AutoGeneratedIdTest extends LocalDatastoreTestCase
{
  public static class HasStringKey
  {
    @Key String keyField;
  }
  public static class HasIntKey
  {
    @Id int keyField;
  }

  public static class HasLongKey
  {
    @Id Long keyField;
  }
 
  @Test
  public void missingStringField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasStringKey hasNullKey = new HasStringKey();
    datastore.store(hasNullKey);
   
    Assert.assertNotNull(hasNullKey.keyField);
  }

  @Test
  public void missingIntField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasIntKey hasNullKey = new HasIntKey();
    datastore.store(hasNullKey);
   
    Assert.assertTrue(hasNullKey.keyField > 0);
  }

  @Test
  public void missingLongField()
  {
    ObjectDatastore datastore = new AnnotationObjectDatastore();
   
    HasLongKey hasNullKey = new HasLongKey();
    datastore.store(hasNullKey);
   
    Assert.assertNotNull(hasNullKey.keyField);
  }
 
 
}
TOP

Related Classes of com.vercer.engine.persist.AutoGeneratedIdTest$HasStringKey

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.