Package com.avaje.tests.compositekeys

Source Code of com.avaje.tests.compositekeys.TestCKeyDelete

package com.avaje.tests.compositekeys;

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

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.basic.CKeyParent;
import com.avaje.tests.model.basic.CKeyParentId;

public class TestCKeyDelete extends BaseTestCase {

  @Test
  public void test() {

    CKeyParentId id = new CKeyParentId(100, "deleteMe");
    CKeyParentId searchId = new CKeyParentId(100, "deleteMe");

    CKeyParent p = new CKeyParent();
    p.setId(id);
    p.setName("testDelete");

    Ebean.save(p);

    CKeyParent found = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();

    Assert.assertNotNull(found);

    Ebean.delete(CKeyParent.class, searchId);

    CKeyParent notFound = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();

    Assert.assertNull(notFound);

  }
}
TOP

Related Classes of com.avaje.tests.compositekeys.TestCKeyDelete

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.