Package com.avaje.tests.config

Source Code of com.avaje.tests.config.TestTableName

package com.avaje.tests.config;

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

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.config.TableName;

public class TestTableName extends BaseTestCase {

  @Test
  public void test() {
   
    TableName t = new TableName("a");
    Assert.assertEquals("a", t.getName());
    Assert.assertNull(t.getCatalog());
    Assert.assertNull(t.getSchema());

    t = new TableName("b.a");
    Assert.assertEquals("a", t.getName());
    Assert.assertEquals("b", t.getSchema());
    Assert.assertNull(t.getCatalog());

    t = new TableName("c.b.a");
    Assert.assertEquals("a", t.getName());
    Assert.assertEquals("b", t.getSchema());
    Assert.assertEquals("c", t.getCatalog());
   
//    try {
//      TableName t2 = new TableName("d.c.b.a");
//      Assert.assertNotNull(t2);
//      Assert.assertTrue(false);
//    } catch (RuntimeException e){
//      Assert.assertTrue(true);
//    }
   
   
//    TableName lhs = new TableName("test.oe_order");
//    TableName rhs = new TableName("test.oe_cust");
//   
//    UnderscoreNamingConvention nc = new UnderscoreNamingConvention();
//    TableName intTab = nc.getM2MJoinTableName(lhs, rhs);
//   
//    Assert.assertNull(intTab.getCatalog());
//    Assert.assertEquals("test", intTab.getSchema());
//    Assert.assertEquals("oe_order_cust", intTab.getName());
  }
}
TOP

Related Classes of com.avaje.tests.config.TestTableName

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.