Browse Source

DEC-15106 test: 补充单元测试

release/10.0
lidongy 4 years ago
parent
commit
cfef014fdf
  1. 7
      fine-hibernate/pom.xml
  2. 38
      fine-hibernate/src/test/java/com/fr/third/org/hibernate/dialect/MySQLDialectTest.java

7
fine-hibernate/pom.xml

@ -107,5 +107,12 @@
<scope>system</scope>
<systemPath>${basedir}/lib/validation-api-1.1.0.Final.jar</systemPath>
</dependency>
<dependency>
<groupId>com.fr.third</groupId>
<artifactId>junit</artifactId>
<version>local</version>
<scope>system</scope>
<systemPath>${basedir}/lib/junit-4.12.jar</systemPath>
</dependency>
</dependencies>
</project>

38
fine-hibernate/src/test/java/com/fr/third/org/hibernate/dialect/MySQLDialectTest.java

@ -0,0 +1,38 @@
package com.fr.third.org.hibernate.dialect;
import com.fr.third.org.hibernate.mapping.Column;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
* @author lidongy
* @version 10.0
* Created by lidongy on 2020/9/18
*/
public class MySQLDialectTest {
@Test
public void testSqlConstraintString() {
List<Column> columnList = new ArrayList<>();
Column column1 = new Column();
column1.setName("id1");
column1.setLength(1000);
Column column2 = new Column();
column2.setName("id2");
column2.setLength(200);
Column column3 = new Column();
column3.setName("id3");
column3.setLength(255);
columnList.add(column1);
columnList.add(column2);
columnList.add(column3);
Assert.assertEquals(new MySQLDialect().sqlConstraintString(columnList), "primary key (id1, id2, id3)");
Assert.assertEquals(new MySQL5Dialect().sqlConstraintString(columnList), "key (id1(255), id2, id3)");
Assert.assertEquals(new MySQL8Dialect().sqlConstraintString(columnList), "primary key (id1, id2, id3)");
}
}
Loading…
Cancel
Save