Package com.avaje.tests.basic.event

Source Code of com.avaje.tests.basic.event.TestQueryAdapter

package com.avaje.tests.basic.event;

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

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.Query;
import com.avaje.tests.model.basic.ResetBasicData;
import com.avaje.tests.model.basic.TOne;

public class TestQueryAdapter extends BaseTestCase {

  @Test
  public void testSimple() {
   
    ResetBasicData.reset();
   
    TOne o = new TOne();
    o.setName("something");
   
    Ebean.save(o);
   
    //Ebean.find(TOne.class, o.getId());
   
    Query<TOne> queryFindId = Ebean.find(TOne.class)
      .setId(o.getId());
   
    TOne one = queryFindId.findUnique();
    Assert.assertNotNull(one);
    Assert.assertEquals(one.getId(), o.getId());
    String generatedSql = queryFindId.getGeneratedSql();
    Assert.assertTrue(generatedSql.contains(" 1=1"));
   
  }
}
TOP

Related Classes of com.avaje.tests.basic.event.TestQueryAdapter

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.