Package com.avaje.tests.batchload

Source Code of com.avaje.tests.batchload.TestLazyLoadNonExistantBean

package com.avaje.tests.batchload;

import java.util.UUID;

import javax.persistence.EntityNotFoundException;

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

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.basic.UUOne;

public class TestLazyLoadNonExistantBean extends BaseTestCase {

  @Test
  public void testSimple() {

    UUID uuid = UUID.randomUUID();
    UUOne one = Ebean.getReference(UUOne.class, uuid);

    try {
      // invoke lazy loading
      one.getName();
      Assert.assertTrue(false);
    } catch (EntityNotFoundException e) {
      // expecting this
      Assert.assertTrue(true);
    }
  }
}
TOP

Related Classes of com.avaje.tests.batchload.TestLazyLoadNonExistantBean

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.