Skip to content

Commit 1ce5cc6

Browse files
committed
Switching from TestNG to JUnit
1 parent f9b3524 commit 1ce5cc6

71 files changed

Lines changed: 883 additions & 1778 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ repositories {
2727

2828
dependencies {
2929
testCompile 'junit:junit:4.11'
30-
testCompile 'org.testng:testng:6.3.1'
3130
testCompile 'org.codehaus.groovy:groovy-all:2.0.8'
3231
testCompile ('org.spockframework:spock-core:0.7-groovy-2.0') {
3332
exclude group: 'junit', module: 'junit-dep'
@@ -45,7 +44,9 @@ sourceSets {
4544
}
4645

4746
test {
48-
useTestNG()
47+
maxHeapSize = "512m"
48+
49+
useJUnit()
4950
jacoco { enabled = false }
5051

5152
beforeTest { descr ->

build.xml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ limitations under the License.
4444
<!-- ******************************************************************* -->
4545

4646
<path id="test.classpath">
47-
<pathelement location="lib/testng-6.3.1.jar"/>
47+
<pathelement location="lib/junit-4.11.jar"/>
48+
<pathelement location="lib/hamcrest-core-1.3.jar"/>
4849
<path refid="build.classpath"/>
4950
</path>
5051
<path id="cobertura.classpath">
@@ -68,7 +69,6 @@ limitations under the License.
6869
<taskdef classpathref="task.classpath" resource="net/sf/antcontrib/antcontrib.properties"/>
6970
<taskdef classpathref="task.classpath" resource="tasks.properties" />
7071
<taskdef classpathref="task.classpath" resource="clirrtask.properties"/>
71-
<taskdef classpathref="task.classpath" name="testng" classname="org.testng.TestNGAntTask"/>
7272

7373
<!-- ******************************************************************* -->
7474
<!-- Vars -->
@@ -288,13 +288,23 @@ limitations under the License.
288288
<target name="test" depends="test-compile, test-nodeps"/>
289289

290290
<target name="test-nodeps">
291-
<testng classpathref="${test.classpath}" outputdir="${test.dir}" listeners="com.mongodb.util.TestNGListener" haltonfailure="false" verbose="1" >
292-
<jvmarg value="-Xmx512M" />
293-
<jvmarg value="-ea" />
291+
<junit fork="true" forkmode="once" haltonfailure="true" maxmemory="512m" printsummary="on">
294292
<jvmarg value="-Dcom.mongodb.slaveAcceptableLatencyMS=${test.com.mongodb.slaveAcceptableLatencyMS}"/>
295-
<sysproperty key="${cobertura.arg}" value="${cobertura.datafile}" />
296-
<classfileset dir="${build.test.dir}" includes="**/${test.classes}.class" />
297-
</testng>
293+
<classpath>
294+
<path refid="test.classpath"/>
295+
<pathelement location="${build.test.dir}"/>
296+
</classpath>
297+
<formatter type="plain" usefile="false" />
298+
<batchtest todir="${test.dir}">
299+
<fileset dir="src/test">
300+
<include name="**/*Test.java"/>
301+
<exclude name="**/PerformanceTest.java"/>
302+
<exclude name="**/ReplPairTest.java"/>
303+
<exclude name="**/ReplSetTest.java"/>
304+
<exclude name="**/SingleThreadedMongoPerfTest.java"/>
305+
</fileset>
306+
</batchtest>
307+
</junit>
298308
</target>
299309

300310
<!-- ******************************************************************* -->

lib/hamcrest-core-1.3.jar

44 KB
Binary file not shown.

lib/junit-4.11.jar

239 KB
Binary file not shown.

lib/testng-6.3.1.jar

-1.2 MB
Binary file not shown.

pom.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ driver developers who would rather use Maven than Ant as their build tool.
4646
</execution>
4747
</executions>
4848
</plugin>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-surefire-plugin</artifactId>
52+
<version>2.16</version>
53+
<configuration>
54+
<argLine>-Xmx512m</argLine>
55+
</configuration>
56+
</plugin>
4957
<plugin>
5058
<groupId>org.apache.felix</groupId>
5159
<artifactId>maven-bundle-plugin</artifactId>
@@ -63,9 +71,9 @@ driver developers who would rather use Maven than Ant as their build tool.
6371

6472
<dependencies>
6573
<dependency>
66-
<groupId>org.testng</groupId>
67-
<artifactId>testng</artifactId>
68-
<version>6.3.1</version>
74+
<groupId>junit</groupId>
75+
<artifactId>junit</artifactId>
76+
<version>4.11</version>
6977
<scope>test</scope>
7078
</dependency>
7179
</dependencies>

src/main/com/mongodb/RawDBObject.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package com.mongodb;
2020

21-
import static com.mongodb.util.MyAsserts.assertEquals;
2221
import static org.bson.BSON.ARRAY;
2322
import static org.bson.BSON.BINARY;
2423
import static org.bson.BSON.BOOLEAN;
@@ -62,7 +61,6 @@ public class RawDBObject implements DBObject {
6261

6362
RawDBObject( ByteBuffer buf ){
6463
this( buf , 0 );
65-
assertEquals( _end , _buf.limit() );
6664
}
6765

6866
RawDBObject( ByteBuffer buf , int offset ){

src/main/com/mongodb/util/MyAsserts.java

Lines changed: 0 additions & 223 deletions
This file was deleted.

src/main/org/bson/BasicBSONEncoder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ private void putBinary( String name , int type , byte[] data ){
411411
int before = _buf.getPosition();
412412
_buf.write( data );
413413
int after = _buf.getPosition();
414-
com.mongodb.util.MyAsserts.assertEquals( after - before , data.length );
415414
}
416415

417416
protected void putUUID( String name , UUID val ){

0 commit comments

Comments
 (0)