You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by pa...@apache.org on 2019/01/07 16:07:35 UTC
svn commit: r1850663 - in /db/torque/torque4/trunk: ./
torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/
torque-runtime/src/test/java/org/apache/torque/
torque-runtime/src/test/java/org/apache/torque/adapter/
torque-runtime/src/test/...
Author: painter
Date: Mon Jan 7 16:07:35 2019
New Revision: 1850663
URL: http://svn.apache.org/viewvc?rev=1850663&view=rev
Log:
Update pom.xml to support testcontainer 1.0.8, updating torque-runtime tests to use @Test annotation
Modified:
db/torque/torque4/trunk/pom.xml
db/torque/torque4/trunk/torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/BaseTestCase.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueInstanceTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/ComboKeyTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/QueryTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/SummaryHelperTest.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/UniqueListTest.java
Modified: db/torque/torque4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/pom.xml?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/pom.xml (original)
+++ db/torque/torque4/trunk/pom.xml Mon Jan 7 16:07:35 2019
@@ -366,12 +366,46 @@
<version>1.4</version>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
+ <!-- we still need this dependency to compile -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <!--scope>test</scope-->
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <!--scope>test</scope-->
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ </dependency>
+ <!-- use Junit 4 within Junit 5 -->
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <version>${junit.platform}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <version>${junit.platform}</version>
+ </dependency>
+
<dependency>
<groupId>junit-addons</groupId>
@@ -409,7 +443,7 @@
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-testcontainer</artifactId>
- <version>1.0.7</version>
+ <version>1.0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -498,7 +532,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M2</version>
<configuration>
+ <!--default setting is forkCount=1/reuseForks=true -->
+ <reuseForks>false</reuseForks>
+ <forkCount>1</forkCount>
<systemProperties>
<property>
<name>derby.stream.error.file</name>
@@ -591,6 +629,10 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<dependency.check.skip>true</dependency.check.skip>
+
+ <junit.jupiter.version>5.3.2</junit.jupiter.version>
+ <junit.platform>1.3.2</junit.platform>
+
</properties>
<profiles>
Modified: db/torque/torque4/trunk/torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java (original)
+++ db/torque/torque4/trunk/torque-maven-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,7 @@
package org.apache.torque.generator.maven;
+import static org.junit.Assert.assertTrue;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,14 +23,15 @@ package org.apache.torque.generator.mave
import java.io.File;
-import junit.framework.TestCase;
+import org.junit.Test;
import org.apache.commons.io.FileUtils;
import org.apache.maven.project.MavenProject;
import org.apache.torque.generator.maven.TorqueGeneratorMojo;
-public class TorqueGeneratorMojoTest extends TestCase
+public class TorqueGeneratorMojoTest
{
+ @Test
public void testRun() throws Exception
{
File target = new File("target/tests/gettingStarted");
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/BaseTestCase.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/BaseTestCase.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/BaseTestCase.java Mon Jan 7 16:07:35 2019
@@ -19,13 +19,14 @@ package org.apache.torque;
* under the License.
*/
-import junit.framework.TestCase;
import org.apache.torque.adapter.IDMethod;
import org.apache.torque.map.ColumnMap;
import org.apache.torque.map.DatabaseMap;
import org.apache.torque.map.TableMap;
+import org.junit.Before;
+
/**
* Base functionality to be extended by all Torque test cases. Test
* case implementations are used to automate unit testing via JUnit.
@@ -34,7 +35,7 @@ import org.apache.torque.map.TableMap;
* @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
* @version $Id$
*/
-public abstract class BaseTestCase extends TestCase
+public abstract class BaseTestCase
{
/** The path to the configuration file. */
public static final String CONFIG_FILE
@@ -74,9 +75,9 @@ public abstract class BaseTestCase exten
* Re-Initialize Torque and fill supplied data. Subclasses which
* override setUp() must call super.setUp() as their first action.
*
- * @throws Exception if initialisation fails.
+ * @throws Exception if initialization fails.
*/
- @Override
+ @Before
public void setUp() throws Exception
{
Torque.setInstance(null);
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java Mon Jan 7 16:07:35 2019
@@ -1,6 +1,7 @@
package org.apache.torque;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,13 +21,25 @@ package org.apache.torque;
* under the License.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
/**
- * Test for the class ColumnImpl.
+ * Test for the class ColumnImpl
*
* @version $Id$
*/
-public class ColumnImplTest extends BaseTestCase
+public class ColumnImplTest
{
+
+ /**
+ * Test table column constructor
+ */
+ @Test
public void testTableColumnConstructor()
{
ColumnImpl column = new ColumnImpl(
@@ -40,6 +53,10 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ /**
+ * Test table column constructor with schema in table
+ */
+ @Test
public void testTableColumnConstructorWithSchemaInTable()
{
ColumnImpl column = new ColumnImpl(
@@ -53,6 +70,10 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ /**
+ * Test table column constructor with null table name
+ */
+ @Test
public void testTableColumnConstructorNullTableName()
{
try
@@ -66,6 +87,10 @@ public class ColumnImplTest extends Base
}
}
+ /**
+ * Test table column constructor with blank table name
+ */
+ @Test
public void testTableColumnConstructorBlankTableName()
{
try
@@ -79,6 +104,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testTableColumnConstructorNullColumnName()
{
try
@@ -92,6 +118,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testTableColumnConstructorBlankColumnName()
{
try
@@ -105,6 +132,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSchemaTableColumnConstructor()
{
ColumnImpl column = new ColumnImpl(
@@ -119,6 +147,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSchemaTableColumnConstructorWithSchemaInConstructorAndTable()
{
ColumnImpl column = new ColumnImpl(
@@ -133,6 +162,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSchemaTableColumnConstructorWithSchemaInTable()
{
ColumnImpl column = new ColumnImpl(
@@ -147,6 +177,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSchemaTableColumnConstructorNullSchemaName()
{
ColumnImpl column = new ColumnImpl(
@@ -159,6 +190,7 @@ public class ColumnImplTest extends Base
assertEquals("tableName.columnName", column.getSqlExpression());
}
+ @Test
public void testSchemaTableColumnConstructorNullTableName()
{
ColumnImpl column = new ColumnImpl("schemaName", null, "columnName");
@@ -168,6 +200,7 @@ public class ColumnImplTest extends Base
assertEquals("columnName", column.getSqlExpression());
}
+ @Test
public void testSchemaTableColumnConstructorBlankSchemaName()
{
try
@@ -181,6 +214,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSchemaTableColumnConstructorBlankTableName()
{
try
@@ -194,6 +228,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSchemaTableColumnConstructorNullColumnName()
{
try
@@ -207,6 +242,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSchemaTableColumnConstructorBlankColumnName()
{
try
@@ -220,6 +256,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructor()
{
ColumnImpl column = new ColumnImpl("schemaName.tableName.columnName");
@@ -229,6 +266,7 @@ public class ColumnImplTest extends Base
assertEquals("tableName.columnName", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorNull()
{
try
@@ -242,6 +280,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructorBlank()
{
try
@@ -255,6 +294,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructorNoDot()
{
ColumnImpl column = new ColumnImpl("columnName");
@@ -264,6 +304,7 @@ public class ColumnImplTest extends Base
assertEquals("columnName", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorAsterisk()
{
ColumnImpl column = new ColumnImpl("tableName.*");
@@ -273,6 +314,7 @@ public class ColumnImplTest extends Base
assertEquals("tableName.*", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorAsteriskAndSchema()
{
ColumnImpl column = new ColumnImpl("schemaName.tableName.*");
@@ -282,6 +324,7 @@ public class ColumnImplTest extends Base
assertEquals("tableName.*", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorBlankColumnName()
{
try
@@ -294,6 +337,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructorBlankTableName()
{
try
@@ -307,6 +351,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructorCount()
{
ColumnImpl column
@@ -319,6 +364,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorSqlFunction()
{
ColumnImpl column = new ColumnImpl(
@@ -331,6 +377,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorComparisonAfter()
{
ColumnImpl column = new ColumnImpl("tableName.columnName < 10");
@@ -342,6 +389,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorComparisonBefore()
{
ColumnImpl column = new ColumnImpl("10 < tableName.columnName");
@@ -353,6 +401,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorInClause()
{
ColumnImpl column = new ColumnImpl("tableName.columnName in (1,2,3)");
@@ -364,6 +413,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorSqlFunctionAsteriskColumnName()
{
ColumnImpl column = new ColumnImpl("count(tableName.*)");
@@ -372,6 +422,7 @@ public class ColumnImplTest extends Base
assertEquals("count(tableName.*)", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorSqlFunctionAsteriskOnly()
{
ColumnImpl column = new ColumnImpl("count(*)");
@@ -380,6 +431,7 @@ public class ColumnImplTest extends Base
assertEquals("count(*)", column.getSqlExpression());
}
+ @Test
public void testSqlExpressionConstructorSqlFunctionEmptyTableName()
{
try
@@ -393,6 +445,7 @@ public class ColumnImplTest extends Base
}
}
+ @Test
public void testSqlExpressionConstructorAlias()
{
ColumnImpl column = new ColumnImpl("tableName.columnName AS x");
@@ -403,12 +456,14 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testGetSqlExpressionNoSchema()
{
ColumnImpl column = new ColumnImpl(null, "tableName", "columnName");
assertEquals("tableName.columnName", column.getSqlExpression());
}
+ @Test
public void testGetSqlExpressionWithSchema()
{
ColumnImpl column
@@ -418,6 +473,7 @@ public class ColumnImplTest extends Base
column.getSqlExpression());
}
+ @Test
public void testEquals()
{
ColumnImpl column1 = new ColumnImpl(
@@ -433,6 +489,7 @@ public class ColumnImplTest extends Base
assertTrue(column1.equals(column2));
}
+ @Test
public void testEqualsSchemaTableColumnNull()
{
ColumnImpl column1 = new ColumnImpl(
@@ -448,6 +505,7 @@ public class ColumnImplTest extends Base
assertTrue(column1.equals(column2));
}
+ @Test
public void testEqualsWrongColumn()
{
ColumnImpl column1 = new ColumnImpl(
@@ -461,6 +519,7 @@ public class ColumnImplTest extends Base
assertFalse(column1.equals(column2));
}
+ @Test
public void testEqualsWrongTable()
{
ColumnImpl column1 = new ColumnImpl(
@@ -474,6 +533,7 @@ public class ColumnImplTest extends Base
assertFalse(column1.equals(column2));
}
+ @Test
public void testEqualsWrongSchema()
{
ColumnImpl column1 = new ColumnImpl(
@@ -487,6 +547,7 @@ public class ColumnImplTest extends Base
assertFalse(column1.equals(column2));
}
+ @Test
public void testEqualsWrongSqlExpression()
{
ColumnImpl column1 = new ColumnImpl("tableName.columnName AS x");
@@ -494,6 +555,7 @@ public class ColumnImplTest extends Base
assertFalse(column1.equals(column2));
}
+ @Test
public void testToString()
{
ColumnImpl column = new ColumnImpl(
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueInstanceTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueInstanceTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueInstanceTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueInstanceTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,13 @@
package org.apache.torque;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,6 +32,7 @@ import java.util.Map;
import org.apache.torque.adapter.Adapter;
import org.apache.torque.adapter.PostgresAdapter;
import org.apache.torque.dsfactory.DataSourceFactory;
+import org.junit.Test;
/**
* Tests the TorqueInstance Class.
@@ -49,6 +58,7 @@ public class TorqueInstanceTest extends
* Tests whether an external adapter is loaded correctly.
* @throws Exception if an error occurs during the Test.
*/
+ @Test
public void testExternalAdapter() throws Exception
{
Adapter adapter = Torque.getDatabase(POSTGRESQL_NAME).getAdapter();
@@ -61,6 +71,7 @@ public class TorqueInstanceTest extends
* <code>DEFAULT_NAME</code> is defined. (TRQS 322)
* @throws Exception if an error occurs during the Test.
*/
+ @Test
public void testDefaultDataSourceFactory() throws Exception
{
DataSourceFactory defaultDataSourceFactory
@@ -83,6 +94,7 @@ public class TorqueInstanceTest extends
* Tests whether the databaseInfo objects are filled correctly.
* @throws Exception if an error occurs during the Test.
*/
+ @Test
public void testDatabases() throws Exception
{
Map<String, Database> databases = Torque.getDatabases();
@@ -108,6 +120,7 @@ public class TorqueInstanceTest extends
* Tests whether the schema information in the databases is filled
* correctly.
*/
+ @Test
public void testSchemata() throws Exception
{
Torque.shutdown();
@@ -123,6 +136,7 @@ public class TorqueInstanceTest extends
databases.get(POSTGRESQL_NAME).getSchema());
}
+ @Test
public void testShutdown() throws Exception
{
// because we have not properly initialized the DataSourceFactory,
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java Mon Jan 7 16:07:35 2019
@@ -22,14 +22,20 @@ package org.apache.torque;
import java.io.PrintWriter;
import java.io.StringWriter;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+
/**
* Tests the class TorqueRuntimeException
*/
-public class TorqueRuntimeExceptionTest extends BaseTestCase
+public class TorqueRuntimeExceptionTest
{
/**
* Tests whether printstackTrace works.
*/
+ @Test
public void testPrintStackTrace()
{
StringWriter stringWriter = new StringWriter();
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java Mon Jan 7 16:07:35 2019
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.apache.torque.sql.Query;
import org.apache.torque.util.UniqueList;
+import org.junit.Test;
public class DBOracleTest extends TestCase
{
@@ -30,6 +31,7 @@ public class DBOracleTest extends TestCa
* Tests whether replacing the select columns in limit/offset
* treatment works (double column names must be aliased)
*/
+ @Test
public void testSelectColumnsForLimitOffset()
{
UniqueList<String> input = new UniqueList<>();
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java Mon Jan 7 16:07:35 2019
@@ -21,6 +21,8 @@ package org.apache.torque.avalon;
import org.apache.fulcrum.testcontainer.BaseUnitTest;
import org.apache.torque.BaseTestCase;
+import org.junit.Before;
+import org.junit.Test;
/**
* Basic testing of the Torque Avalon Component
@@ -42,7 +44,7 @@ public class AvalonTest extends BaseUnit
super(name);
}
- @Override
+ @Before
public void setUp() throws Exception
{
}
@@ -50,6 +52,7 @@ public class AvalonTest extends BaseUnit
/**
* Verifies that the container initialization and lookup works properly.
*/
+ @Test
public void testAvalonTorqueNotInitialized() throws Exception
{
setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
@@ -64,6 +67,7 @@ public class AvalonTest extends BaseUnit
/**
* Verifies that the container initialization and lookup works properly.
*/
+ @Test
public void testAvalonTorqueInitialized() throws Exception
{
org.apache.torque.Torque.setInstance(null);
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,8 @@
package org.apache.torque.criteria;
+
+
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -38,6 +41,14 @@ import org.apache.torque.sql.OrderBy;
import org.apache.torque.sql.Query;
import org.apache.torque.sql.SqlBuilder;
import org.apache.torque.util.UniqueList;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Test class for Criteria.
@@ -56,7 +67,7 @@ public class CriteriaTest extends BaseTe
/**
* Initializes the criteria.
*/
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -95,6 +106,7 @@ public class CriteriaTest extends BaseTe
/**
* Test basic where condition on a string.
*/
+ @Test
public void testWhereString()
{
final Column column = new ColumnImpl("myTable", "myColumn");
@@ -115,6 +127,7 @@ public class CriteriaTest extends BaseTe
* Test basic where condition on a string. The condition is reversed, i.e
* the String preceeds the column.
*/
+ @Test
public void testWhereStringReversed()
{
final Column column = new ColumnImpl("myTable", "myColumn");
@@ -135,6 +148,7 @@ public class CriteriaTest extends BaseTe
* Test basic where condition on a string with a non-equal.
* comparison operator.
*/
+ @Test
public void testWhereNotEqual()
{
final Column column = new ColumnImpl("myTable", "myColumn");
@@ -156,6 +170,7 @@ public class CriteriaTest extends BaseTe
* Tests that unary operators as rValue are interpreted
* as comparison operator in the two-arg where method.
*/
+ @Test
public void testWhereUnaryOperator()
{
// prepare
@@ -175,6 +190,7 @@ public class CriteriaTest extends BaseTe
* Tests that unary operators as rValue are interpreted
* as comparison operator in the two-arg or method.
*/
+ @Test
public void testOrUnaryOperator()
{
// prepare
@@ -193,6 +209,7 @@ public class CriteriaTest extends BaseTe
/**
* Test where condition with several ANDs compairing against Strings.
*/
+ @Test
public void testAndString()
{
final Column column1 = new ColumnImpl("myTable", "myColumn1");
@@ -255,6 +272,7 @@ public class CriteriaTest extends BaseTe
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCriteriaTopLevelCriterionGetsCopiedWhere()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -267,6 +285,7 @@ public class CriteriaTest extends BaseTe
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCriteriaTopLevelCriterionGetsCopiedOr()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -279,6 +298,7 @@ public class CriteriaTest extends BaseTe
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCriteriaCriterionGetsCopiedWhere()
{
Criteria criteria = new Criteria().where(stringColumnMap, "def");
@@ -297,6 +317,7 @@ public class CriteriaTest extends BaseTe
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCriteriaCriterionGetsCopiedOr()
{
Criteria criteria = new Criteria().where(stringColumnMap, "def");
@@ -315,6 +336,7 @@ public class CriteriaTest extends BaseTe
* root criterion to a criteria which is afterwards changed.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionDoesNotGetChangedByCriteriaOr()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -330,6 +352,7 @@ public class CriteriaTest extends BaseTe
* root criterion to a criteria which is afterwards changed.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionDoesNotGetChangedByCriteriaAnd()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -343,6 +366,7 @@ public class CriteriaTest extends BaseTe
/**
* Test that nesting Criterions works for equals comparison.
*/
+ @Test
public void testNestedCriterionComparisonEqual() throws TorqueException
{
final Column column2 = new ColumnImpl("myTable2", "myColumn2");
@@ -389,7 +413,9 @@ public class CriteriaTest extends BaseTe
/**
* Test that nesting Criterions works for other comparisons than equal.
+ * @throws TorqueException if fails
*/
+ @Test
public void testNestedCriterionComparisonLessGreaterThan()
throws TorqueException
{
@@ -445,7 +471,9 @@ public class CriteriaTest extends BaseTe
/**
* Tests <= and =>.
+ * @throws TorqueException if fail
*/
+ @Test
public void testBetweenCriterion() throws TorqueException
{
Criterion cn1 = new Criterion(
@@ -471,6 +499,7 @@ public class CriteriaTest extends BaseTe
/**
* Test Criterion.setIgnoreCase().
*/
+ @Test
public void testCriterionIgnoreCase() throws TorqueException
{
Criterion criterion1 = new Criterion(
@@ -505,6 +534,7 @@ public class CriteriaTest extends BaseTe
/**
* Test that true is evaluated correctly in Mysql.
*/
+ @Test
public void testBooleanMysql() throws TorqueException
{
c.where(new ColumnImpl("TABLE", "COLUMN"), true);
@@ -524,6 +554,7 @@ public class CriteriaTest extends BaseTe
/**
* Test that true is evaluated correctly in Postgresql.
*/
+ @Test
public void testBooleanPostgresql() throws TorqueException
{
// test the postgresql variation
@@ -544,6 +575,7 @@ public class CriteriaTest extends BaseTe
/**
* Testcase for whereDate()
*/
+ @Test
public void testWhereDate() throws TorqueException
{
c.whereDate(new ColumnImpl("TABLE", "DATE_COLUMN"), 2003, 0, 22);
@@ -564,6 +596,7 @@ public class CriteriaTest extends BaseTe
/**
* Testcase for andDate().
*/
+ @Test
public void testAndDate() throws TorqueException
{
c.whereDate(new ColumnImpl("TABLE", "DATE_COLUMN"),
@@ -596,6 +629,7 @@ public class CriteriaTest extends BaseTe
/**
* testcase for where(Date)
*/
+ @Test
public void testDateWhere() throws TorqueException
{
Calendar cal = new GregorianCalendar(2003, 0, 22);
@@ -616,6 +650,7 @@ public class CriteriaTest extends BaseTe
preparedStatementReplacements.get(0));
}
+ @Test
public void testAndCurrentDate() throws TorqueException
{
c.where(new ColumnImpl("TABLE", "DATE_COLUMN"), Criteria.CURRENT_DATE);
@@ -632,6 +667,7 @@ public class CriteriaTest extends BaseTe
assertEquals(0, preparedStatementReplacements.size());
}
+ @Test
public void testAndCurrentTime() throws TorqueException
{
c.where(new ColumnImpl("TABLE", "TIME_COLUMN"), Criteria.CURRENT_TIME);
@@ -648,6 +684,7 @@ public class CriteriaTest extends BaseTe
assertEquals(0, preparedStatementReplacements.size());
}
+ @Test
public void testCriteriaOffsetLimit() throws TorqueException
{
c.whereDate(new ColumnImpl("TABLE", "DATE_COLUMN"), 2003, 0, 22);
@@ -661,6 +698,7 @@ public class CriteriaTest extends BaseTe
assertEquals(expect, result.toString());
}
+ @Test
public void testCriteriaWithOffsetNoLimitPostgresql()
throws TorqueException
{
@@ -678,6 +716,7 @@ public class CriteriaTest extends BaseTe
/**
* TORQUE-87
*/
+ @Test
public void testCriteriaWithOffsetNoLimitMysql() throws TorqueException
{
c.whereDate(new ColumnImpl("TABLE", "DATE_COLUMN"), 2003, 0, 22);
@@ -692,6 +731,7 @@ public class CriteriaTest extends BaseTe
assertEquals(expect, result.toString());
}
+ @Test
public void testCriteriaToStringLimit() throws TorqueException
{
c.whereDate(new ColumnImpl("TABLE", "DATE_COLUMN"), 2003, 0, 22);
@@ -710,6 +750,7 @@ public class CriteriaTest extends BaseTe
* get replaced through Criteria.EQUAL if there are no SQL wildcards
* in the given value.
*/
+ @Test
public void testLikeWithoutWildcards() throws TorqueException
{
c.where(new ColumnImpl("TABLE", "COLUMN"),
@@ -735,6 +776,7 @@ public class CriteriaTest extends BaseTe
* get replaced through Criteria.NOT_EQUAL if there are no SQL wildcards
* in the given value.
*/
+ @Test
public void testNotLikeWithoutWildcards()
{
c.where(new ColumnImpl("TABLE", "COLUMN"),
@@ -766,6 +808,7 @@ public class CriteriaTest extends BaseTe
/**
* Test that serialization works.
*/
+ @Test
public void testSerialization()
{
c.setOffset(10);
@@ -871,6 +914,7 @@ public class CriteriaTest extends BaseTe
/**
* Test that cloning works.
*/
+ @Test
public void testClone()
{
c.setOffset(10);
@@ -966,6 +1010,7 @@ public class CriteriaTest extends BaseTe
* Criteria object.
* @throws TorqueException
*/
+ @Test
public void testEquals() throws TorqueException
{
c.addSelectColumn(new ColumnImpl("Author", "NAME"));
@@ -978,6 +1023,7 @@ public class CriteriaTest extends BaseTe
/**
* Checks whether orderBy works.
*/
+ @Test
public void testOrderBy() throws TorqueException
{
// we need a rudimentary databaseMap for this test case to work
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java Mon Jan 7 16:07:35 2019
@@ -21,6 +21,13 @@ package org.apache.torque.criteria;
import static org.junit.Assert.assertArrayEquals;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+
import org.apache.torque.BaseTestCase;
import org.apache.torque.ColumnImpl;
@@ -32,6 +39,7 @@ import org.apache.torque.ColumnImpl;
public class CriterionTest extends BaseTestCase
{
+ @Test
public void testHashCodeAndEquals()
{
Criterion criterion = new Criterion(
@@ -46,6 +54,7 @@ public class CriterionTest extends BaseT
assertEquals(criterion, compareToCriterion);
}
+ @Test
public void testToStringSingleCriterion()
{
Criterion criterion = new Criterion(
@@ -55,6 +64,7 @@ public class CriterionTest extends BaseT
criterion.toString());
}
+ @Test
public void testToStringCompositeCriterion()
{
Criterion criterion = new Criterion(
@@ -80,6 +90,7 @@ public class CriterionTest extends BaseT
* criterion.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionAndedToTopLevelCriterionGetsCopied()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -94,6 +105,7 @@ public class CriterionTest extends BaseT
* criterion.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionOredToTopLevelCriterionGetsCopied()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -108,6 +120,7 @@ public class CriterionTest extends BaseT
* criterion.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionAndedToCriterionGetsCopied()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -124,6 +137,7 @@ public class CriterionTest extends BaseT
* criterion.
* checks TORQUE-243.
*/
+ @Test
public void testCriterionOredToCriterionGetsCopied()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -140,6 +154,7 @@ public class CriterionTest extends BaseT
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCopyConstructorSimpleCriterion()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -159,6 +174,7 @@ public class CriterionTest extends BaseT
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCopyConstructorCompositeCriterion()
{
Criterion criterion = new Criterion(stringColumnMap, "abc");
@@ -181,6 +197,7 @@ public class CriterionTest extends BaseT
* using where (also tests and).
* checks TORQUE-243.
*/
+ @Test
public void testCopyConstructorSqlCriterion()
{
Criterion criterion = new Criterion(null, null, null, "select 1", new Object[] {1});
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java Mon Jan 7 16:07:35 2019
@@ -22,6 +22,11 @@ package org.apache.torque.criteria;
import org.apache.torque.BaseTestCase;
import org.apache.torque.ColumnImpl;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
/**
* Test for the Join class.
*
@@ -29,6 +34,7 @@ import org.apache.torque.ColumnImpl;
*/
public class JoinTest extends BaseTestCase
{
+ @Test
public void testHashCodeAndEquals()
{
Join join = new Join(
@@ -45,7 +51,7 @@ public class JoinTest extends BaseTestCa
assertEquals(join, compareToJoin);
}
-
+ @Test
public void testToString()
{
Join join = new Join(
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java Mon Jan 7 16:07:35 2019
@@ -2,6 +2,10 @@ package org.apache.torque.map;
import org.apache.torque.BaseTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -29,12 +33,14 @@ import org.apache.torque.BaseTestCase;
*/
public class ColumnMapTest extends BaseTestCase
{
+ @Test
public void testGetSqlExpressionNoSchemaDefaultSchemaNull()
{
ColumnMap column = new ColumnMap("columnName", tableMap);
assertEquals("TABLE.columnName", column.getSqlExpression());
}
+ @Test
public void testGetFullTableNameWithoutDefaultSchema()
{
ColumnMap column = new ColumnMap("columnName", tableMap);
@@ -43,6 +49,7 @@ public class ColumnMapTest extends BaseT
column.getFullTableName());
}
+ @Test
public void testGetFullTableNameWithDefaultSchema()
{
tableMap = databaseMap.addTable("schemaName.TABLE");
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/ComboKeyTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/ComboKeyTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/ComboKeyTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/ComboKeyTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,11 @@
package org.apache.torque.om;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.torque.BaseTestCase;
+import org.junit.Test;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,9 +26,6 @@ package org.apache.torque.om;
*/
import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
/**
* TestCase for ComboKey
@@ -30,7 +33,7 @@ import junit.framework.TestSuite;
* @author <a href="mailto:drfish@cox.net">J. Russell Smyth</a>
* @version $Id$
*/
-public class ComboKeyTest extends TestCase
+public class ComboKeyTest extends BaseTestCase
{
private ComboKey c1a = new ComboKey(
new SimpleKey[]{new StringKey("key1"), new StringKey("key2")});
@@ -45,57 +48,30 @@ public class ComboKeyTest extends TestCa
private ComboKey c4a = new ComboKey(
new SimpleKey[]{new StringKey("key1"), null, new NumberKey(123456)});
- /**
- * Simple constructor.
- *
- * @param name the name of the test to execute
- */
- public ComboKeyTest(String name)
- {
- super(name);
- }
-
- /**
- *
- * @param args
- */
- public static void main(java.lang.String[] args)
- {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- *
- * @return Test
- */
- public static Test suite()
- {
- TestSuite suite = new TestSuite(ComboKeyTest.class);
-
- return suite;
- }
/**
*
*
*/
+ @Test
public void testReflexive()
{
- Assert.assertTrue(c1a.equals(c1a));
+ assertTrue(c1a.equals(c1a));
// Complex key using null and date
// This currently has to use looseEquals as ComboKey.equals(Obj)
// does not accept null key values (WHY!)
- Assert.assertTrue(c3a.looseEquals(c3a));
+ assertTrue(c3a.looseEquals(c3a));
}
/**
*
*
*/
+ @Test
public void testSymmetric()
{
- Assert.assertTrue(c1a.equals(c1b));
- Assert.assertTrue(c1b.equals(c1a));
+ assertTrue(c1a.equals(c1b));
+ assertTrue(c1b.equals(c1a));
}
/**
@@ -104,22 +80,24 @@ public class ComboKeyTest extends TestCa
*/
public void testNull()
{
- Assert.assertTrue(!c1a.equals(null));
+ assertTrue(!c1a.equals(null));
}
/**
*
*
*/
+ @Test
public void testNotEqual()
{
- Assert.assertTrue(!c1a.equals(c2a));
+ assertTrue(!c1a.equals(c2a));
}
/**
*
*
*/
+ @Test
public void testRoundTripWithStringKeys()
{
// two strings
@@ -144,6 +122,7 @@ public class ComboKeyTest extends TestCa
*
*
*/
+ @Test
public void testRoundTripWithComplexKey()
{
// complex key
@@ -169,6 +148,7 @@ public class ComboKeyTest extends TestCa
*
*
*/
+ @Test
public void testRoundTripWithNullKey()
{
// with null key
@@ -188,13 +168,14 @@ public class ComboKeyTest extends TestCa
}
// This currently has to use looseEquals as ComboKey.equals(Obj)
// does not accept null key values (WHY!)
- Assert.assertTrue(oldKey.looseEquals(newKey));
+ assertTrue(oldKey.looseEquals(newKey));
}
/**
* Test of appendTo method, of class org.apache.torque.om.ComboKey.
*/
+ @Test
public void testAppendTo()
{
StringBuilder sb = new StringBuilder();
@@ -205,6 +186,7 @@ public class ComboKeyTest extends TestCa
/**
* Test of toString method, of class org.apache.torque.om.ComboKey.
*/
+ @Test
public void testToString()
{
Assert.assertEquals("Skey1::N123456:", c4a.toString());
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,9 @@
package org.apache.torque.om;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,7 +26,9 @@ package org.apache.torque.om;
import java.math.BigDecimal;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.apache.torque.BaseTestCase;
+import org.junit.Test;
+
/**
* Tests the NumberKey class.
@@ -30,7 +36,7 @@ import junit.framework.TestCase;
* @author <a href="mailto:stephenh@chase3000.com">Stephen Haberman</a>
* @version $Id$
*/
-public class NumberKeyTest extends TestCase
+public class NumberKeyTest extends BaseTestCase
{
/** Test value. */
@@ -45,6 +51,7 @@ public class NumberKeyTest extends TestC
/**
* Test a.equals(a)
*/
+ @Test
public void testEqualsReflexive()
{
assertTrue(n1a.equals(n1a));
@@ -53,6 +60,7 @@ public class NumberKeyTest extends TestC
/**
* Test a.hashCode().equals(a.hashCode())
*/
+ @Test
public void testHashCodeEqual()
{
assertEquals(n1a.hashCode(), n1b.hashCode());
@@ -61,6 +69,7 @@ public class NumberKeyTest extends TestC
/**
* Test !a.equals(b)
*/
+ @Test
public void testEqualsFalse()
{
assertFalse(n1a.equals(n2a));
@@ -70,6 +79,7 @@ public class NumberKeyTest extends TestC
/**
* Test a.equals(b) = b.equals(a)
*/
+ @Test
public void testEqualsSymmetric()
{
assertTrue(n1a.equals(n1b));
@@ -84,6 +94,7 @@ public class NumberKeyTest extends TestC
/**
* Test a.equals(b) = b.equals(c) = c.equals(a)
*/
+ @Test
public void testEqualsTransitive()
{
assertTrue(n1a.equals(n1b));
@@ -94,6 +105,7 @@ public class NumberKeyTest extends TestC
/**
* Test !a.equals(null)
*/
+ @Test
public void testEqualsNull()
{
assertFalse(n1a.equals(null));
@@ -102,6 +114,7 @@ public class NumberKeyTest extends TestC
/**
* Test sorting.
*/
+ @Test
public void testList()
{
Object[] array = new Object[] {n1a, n2a, n1b};
@@ -115,6 +128,7 @@ public class NumberKeyTest extends TestC
/**
* Test copy constructor.
*/
+ @Test
public void testEmptyConstructor()
{
NumberKey key = new NumberKey();
@@ -124,6 +138,7 @@ public class NumberKeyTest extends TestC
/**
* Test copy constructor.
*/
+ @Test
public void testCopyConstructor()
{
NumberKey key = new NumberKey(new NumberKey("44"));
@@ -133,6 +148,7 @@ public class NumberKeyTest extends TestC
/**
* Test copy constructor.
*/
+ @Test
public void testCopyConstructorNullValue()
{
NumberKey key = new NumberKey((NumberKey) null);
@@ -142,6 +158,7 @@ public class NumberKeyTest extends TestC
/**
* Test copy constructor.
*/
+ @Test
public void testBigDecimalConstructor()
{
NumberKey key = new NumberKey(new BigDecimal("20.42"));
@@ -151,6 +168,7 @@ public class NumberKeyTest extends TestC
/**
* Test long constructor.
*/
+ @Test
public void testLongConstructor()
{
NumberKey key = new NumberKey(9900000000000001L);
@@ -160,6 +178,7 @@ public class NumberKeyTest extends TestC
/**
* Test double constructor.
*/
+ @Test
public void testDoubleConstructor()
{
NumberKey key = new NumberKey(5d);
@@ -169,6 +188,7 @@ public class NumberKeyTest extends TestC
/**
* Test int constructor.
*/
+ @Test
public void testIntConstructor()
{
NumberKey key = new NumberKey(432);
@@ -178,6 +198,7 @@ public class NumberKeyTest extends TestC
/**
* Test number constructor.
*/
+ @Test
public void testNumberConstructor()
{
NumberKey key = new NumberKey(Integer.valueOf(432));
@@ -187,6 +208,7 @@ public class NumberKeyTest extends TestC
/**
* Test number constructor with null value.
*/
+ @Test
public void testNumberConstructorNull()
{
NumberKey key = new NumberKey((Integer) null);
@@ -196,6 +218,7 @@ public class NumberKeyTest extends TestC
/**
* Test String constructor.
*/
+ @Test
public void testStringConstructor()
{
NumberKey key = new NumberKey("9900000000000001");
@@ -205,6 +228,7 @@ public class NumberKeyTest extends TestC
/**
* Test String constructor with null value.
*/
+ @Test
public void testStringConstructorNull()
{
NumberKey key = new NumberKey((String) null);
@@ -214,6 +238,7 @@ public class NumberKeyTest extends TestC
/**
* Test setValue(String) method.
*/
+ @Test
public void testSetValueString()
{
NumberKey key = new NumberKey();
@@ -224,6 +249,7 @@ public class NumberKeyTest extends TestC
/**
* Test setValue(String) method with null argument.
*/
+ @Test
public void testSetValueStringNull()
{
NumberKey key = new NumberKey();
@@ -234,6 +260,7 @@ public class NumberKeyTest extends TestC
/**
* Test setValue(BigDecimal) method.
*/
+ @Test
public void testSetValueBigDecimal()
{
NumberKey key = new NumberKey();
@@ -244,6 +271,7 @@ public class NumberKeyTest extends TestC
/**
* Test setValue(NumberKey) method.
*/
+ @Test
public void testSetValueNumberKey()
{
NumberKey key = new NumberKey();
@@ -254,6 +282,7 @@ public class NumberKeyTest extends TestC
/**
* Test setValue(NumberKey) method with null argument.
*/
+ @Test
public void testSetValueNumberKeyNull()
{
NumberKey key = new NumberKey();
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java Mon Jan 7 16:07:35 2019
@@ -33,13 +33,23 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
public class BigDecimalMapperTest extends BaseTestCase
{
/** Mock result set. */
@Mock
private ResultSet resultSet;
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -56,6 +66,7 @@ public class BigDecimalMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// prepare
@@ -78,6 +89,7 @@ public class BigDecimalMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowInternalOffset() throws Exception
{
// prepare
@@ -100,6 +112,7 @@ public class BigDecimalMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java Mon Jan 7 16:07:35 2019
@@ -32,6 +32,12 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class CompositeMapperTest extends BaseTestCase
{
/** System under test. */
@@ -56,7 +62,7 @@ public class CompositeMapperTest extends
/** The fake criteria which produced the query .*/
private Criteria criteria = new Criteria();
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -79,6 +85,7 @@ public class CompositeMapperTest extends
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// execute
@@ -100,6 +107,7 @@ public class CompositeMapperTest extends
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java Mon Jan 7 16:07:35 2019
@@ -33,13 +33,19 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class DateMapperTest extends BaseTestCase
{
/** Mock result set. */
@Mock
private ResultSet resultSet;
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -58,6 +64,7 @@ public class DateMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// prepare
@@ -80,6 +87,7 @@ public class DateMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowInternalOffset() throws Exception
{
// prepare
@@ -102,6 +110,7 @@ public class DateMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java Mon Jan 7 16:07:35 2019
@@ -32,13 +32,19 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class IntegerMapperTest extends BaseTestCase
{
/** Mock result set. */
@Mock
private ResultSet resultSet;
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -56,6 +62,7 @@ public class IntegerMapperTest extends B
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// prepare
@@ -80,6 +87,7 @@ public class IntegerMapperTest extends B
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowInternalOffset() throws Exception
{
// prepare
@@ -102,6 +110,7 @@ public class IntegerMapperTest extends B
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java Mon Jan 7 16:07:35 2019
@@ -32,13 +32,19 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class LongMapperTest extends BaseTestCase
{
/** Mock result set. */
@Mock
private ResultSet resultSet;
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -56,6 +62,7 @@ public class LongMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// prepare
@@ -80,6 +87,7 @@ public class LongMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowInternalOffset() throws Exception
{
// prepare
@@ -102,6 +110,7 @@ public class LongMapperTest extends Base
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java Mon Jan 7 16:07:35 2019
@@ -47,6 +47,13 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class ObjectListMapperTest extends BaseTestCase
{
/** Mock result set. */
@@ -84,7 +91,7 @@ public class ObjectListMapperTest extend
/** Object instance. */
private Object object = new Object();
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -127,6 +134,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowLengthDeterminedFromMetadata() throws Exception
{
// prepare
@@ -154,6 +162,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowLengthDeterminedFromMetadataWithOffset()
throws Exception
{
@@ -179,6 +188,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowLenghtAsArgument() throws Exception
{
// prepare
@@ -201,6 +211,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowClassListAsArgument() throws Exception
{
// prepare
@@ -288,6 +299,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
@@ -316,6 +328,7 @@ public class ObjectListMapperTest extend
*
* @throws Exception if the test fails
*/
+ @Test
public void testUnknownClass() throws Exception
{
// prepare
@@ -340,6 +353,12 @@ public class ObjectListMapperTest extend
}
}
+ /**
+ * Tests the byte null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testByteNull() throws Exception
{
// prepare
@@ -361,6 +380,12 @@ public class ObjectListMapperTest extend
verifyNoMoreInteractions(resultSet);
}
+ /**
+ * Tests the short null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testShortNull() throws Exception
{
// prepare
@@ -382,6 +407,12 @@ public class ObjectListMapperTest extend
verifyNoMoreInteractions(resultSet);
}
+ /**
+ * Tests the integer null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testIntegerNull() throws Exception
{
// prepare
@@ -402,6 +433,12 @@ public class ObjectListMapperTest extend
verifyNoMoreInteractions(resultSet);
}
+ /**
+ * Tests the long null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testLongNull() throws Exception
{
// prepare
@@ -422,6 +459,12 @@ public class ObjectListMapperTest extend
verifyNoMoreInteractions(resultSet);
}
+ /**
+ * Tests the double null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testDoubleNull() throws Exception
{
// prepare
@@ -442,6 +485,12 @@ public class ObjectListMapperTest extend
verifyNoMoreInteractions(resultSet);
}
+ /**
+ * Tests the float null for empty result
+ *
+ * @throws Exception if the test fails
+ */
+ @Test
public void testFloatNull() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java Mon Jan 7 16:07:35 2019
@@ -32,13 +32,19 @@ import org.apache.torque.criteria.Criter
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class StringMapperTest extends BaseTestCase
{
/** Mock result set. */
@Mock
private ResultSet resultSet;
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -55,6 +61,7 @@ public class StringMapperTest extends Ba
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRow() throws Exception
{
// prepare
@@ -77,6 +84,7 @@ public class StringMapperTest extends Ba
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowInternalOffset() throws Exception
{
// prepare
@@ -99,6 +107,7 @@ public class StringMapperTest extends Ba
*
* @throws Exception if the test fails
*/
+ @Test
public void testProcessRowSqlException() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/QueryTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/QueryTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/QueryTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/QueryTest.java Mon Jan 7 16:07:35 2019
@@ -23,6 +23,15 @@ import org.apache.torque.BaseTestCase;
import org.apache.torque.criteria.FromElement;
import org.apache.torque.util.UniqueList;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/**
* Tests for Query
*
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java Mon Jan 7 16:07:35 2019
@@ -36,6 +36,15 @@ import org.apache.torque.criteria.Prepar
import org.apache.torque.criteria.SqlEnum;
import org.apache.torque.om.NumberKey;
import org.apache.torque.util.functions.Count;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
/**
* Tests for SqlExpression
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java Mon Jan 7 16:07:35 2019
@@ -54,6 +54,14 @@ import org.apache.torque.om.mapper.Strin
import org.apache.torque.util.functions.Count;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
/**
* Tests the class BasePeerImpl.
@@ -87,7 +95,7 @@ public class BasePeerImplTest extends Ba
@Mock
private IdGenerator idGenerator;
- @Override
+ @Before
public void setUp() throws Exception
{
basePeerImpl = new BasePeerImpl<>();
@@ -115,7 +123,7 @@ public class BasePeerImplTest extends Ba
Transaction.setTransactionManager(transactionManager);
}
- @Override
+ @After
public void tearDown()
{
Transaction.setTransactionManager(oldTransactionManager);
@@ -126,6 +134,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoSelect() throws Exception
{
Criteria criteria = new Criteria();
@@ -177,6 +186,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoSelectWithQuery() throws Exception
{
// single result "fd", 23 found
@@ -211,6 +221,7 @@ public class BasePeerImplTest extends Ba
assertEquals(23, result.get(0).get(1));
}
+ @Test
public void testAddSelectColumns()
{
// prepare
@@ -234,6 +245,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoSelectNoSelectColumnsPresent() throws Exception
{
// prepare
@@ -258,6 +270,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testAddSelectColumnsWithAsColumns() throws Exception
{
// prepare
@@ -283,6 +296,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoSelectAllFetchSize() throws Exception
{
Criteria criteria = new Criteria();
@@ -294,6 +308,7 @@ public class BasePeerImplTest extends Ba
verify(preparedStatement).setFetchSize(13);
}
+ @Test
public void testDeleteWithQualifiedTableName()
throws Exception
{
@@ -327,6 +342,7 @@ public class BasePeerImplTest extends Ba
assertEquals(1, deleteCount);
}
+ @Test
public void testDeleteWithError()
throws Exception
{
@@ -366,6 +382,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoInsertWithoutKeygen() throws Exception
{
// prepare
@@ -408,6 +425,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoInsertWithSubselect() throws Exception
{
// prepare
@@ -446,6 +464,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoInsertWithException() throws Exception
{
// prepare
@@ -492,6 +511,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoInsertWithKeygen() throws Exception
{
// prepare
@@ -532,6 +552,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoUpdate() throws Exception
{
Criteria criteria = new Criteria();
@@ -580,6 +601,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testDoUpdateWithPk() throws Exception
{
ColumnValues updateValues = new ColumnValues(databaseMap.getName());
@@ -622,6 +644,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testExecuteStatementNamed() throws Exception
{
Map<String, JdbcTypedValue> replacementValues = new HashMap<>();
@@ -649,6 +672,7 @@ public class BasePeerImplTest extends Ba
*
* @throws Exception if the test fails.
*/
+ @Test
public void testExecuteStatementNamedNoReplacements() throws Exception
{
Map<String, JdbcTypedValue> replacementValues = new HashMap<>();
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/SummaryHelperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/SummaryHelperTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/SummaryHelperTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/SummaryHelperTest.java Mon Jan 7 16:07:35 2019
@@ -41,6 +41,12 @@ import org.apache.torque.util.functions.
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
/**
* Test class for SummaryHelper.
*
@@ -83,7 +89,7 @@ public class SummaryHelperTest extends B
/**
* Sets up the helper objects and the test.
*/
- @Override
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -132,6 +138,7 @@ public class SummaryHelperTest extends B
/**
* Test basic where condition on a string.
*/
+ @Test
public void testWhereString() throws Exception
{
// prepare
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/UniqueListTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/UniqueListTest.java?rev=1850663&r1=1850662&r2=1850663&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/UniqueListTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/UniqueListTest.java Mon Jan 7 16:07:35 2019
@@ -1,5 +1,10 @@
package org.apache.torque.util;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.torque.BaseTestCase;
+import org.junit.Test;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,7 +24,6 @@ package org.apache.torque.util;
* under the License.
*/
-import junit.framework.TestCase;
/**
* Test for UniqueList
@@ -27,16 +31,13 @@ import junit.framework.TestCase;
* @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
* @version $Id$
*/
-public class UniqueListTest extends TestCase
+public class UniqueListTest extends BaseTestCase
{
- public UniqueListTest(String name)
- {
- super(name);
- }
/**
* null values are not allowed
*/
+ @Test
public void testNull()
{
UniqueList<Object> uniqueList = new UniqueList<>();
@@ -48,6 +49,7 @@ public class UniqueListTest extends Test
/**
* duplicates values are not allowed
*/
+ @Test
public void testUnique()
{
UniqueList<String> uniqueList = new UniqueList<>();
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org