Package com.github.jmkgreen.morphia.query

Source Code of com.github.jmkgreen.morphia.query.TestMandatoryId$E

/**
*
*/
package com.github.jmkgreen.morphia.query;

import org.junit.Test;

import com.github.jmkgreen.morphia.Key;
import com.github.jmkgreen.morphia.TestBase;
import com.github.jmkgreen.morphia.annotations.Entity;
import com.github.jmkgreen.morphia.testutil.AssertedFailure;


public class TestMandatoryId extends TestBase {
 
  @Entity
  public static class E {
    // not id here
    String foo = "bar";
  }
 
  @Test
  public final void testMissingId() {
    new AssertedFailure() {
     
      @Override
      protected void thisMustFail() throws Throwable {
        morphia.map(E.class);
      }
    };
  }
 
  @Test
  public final void testMissingIdNoImplicitMapCall() {
    final Key<E> save = ds.save(new E());
   
    new AssertedFailure() {
      @Override
      protected void thisMustFail() throws Throwable {
        E byKey = ds.getByKey(E.class, save);
      }
    };
  }

}
TOP

Related Classes of com.github.jmkgreen.morphia.query.TestMandatoryId$E

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.