Package com.avaje.tests.transaction

Source Code of com.avaje.tests.transaction.TestNested

package com.avaje.tests.transaction;

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

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.TxRunnable;

public class TestNested extends BaseTestCase {

  @Test
  public void test() {

    try {
      Ebean.execute(new TxRunnable() {
        public void run() {

          willFail();
        }
      });
    } catch (RuntimeException e) {
      Assert.assertEquals(e.getMessage(), "test rollback");
    }
  }

  private void willFail() {
    Ebean.execute(new TxRunnable() {
      public void run() {

        String msg = "test rollback";
        throw new RuntimeException(msg);

      }
    });
  }
}
TOP

Related Classes of com.avaje.tests.transaction.TestNested

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.