Skip to content

Commit d1cbcc3

Browse files
jUnit to TestNG conversion
1 parent a4fc06e commit d1cbcc3

3 files changed

Lines changed: 32 additions & 32 deletions

File tree

driver-core/src/test/java/com/datastax/driver/core/DataTypeTest.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import java.util.Set;
3232
import java.util.UUID;
3333

34-
import org.junit.Test;
35-
import static org.junit.Assert.*;
34+
import org.testng.annotations.Test;
35+
import static org.testng.Assert.*;
3636

3737
/**
3838
* Tests DataType class to ensure data sent in is the same as data received
@@ -395,8 +395,8 @@ public void primitiveInsertTest() throws Throwable {
395395
rs = session.execute(execute_string);
396396
assertTrue(rs.isExhausted());
397397
}
398-
assertEquals(15, SAMPLE_DATA.size());
399-
assertEquals(SAMPLE_DATA.size(), PRIMITIVE_INSERT_STATEMENTS.size());
398+
assertEquals(SAMPLE_DATA.size(), 15);
399+
assertEquals(PRIMITIVE_INSERT_STATEMENTS.size(), SAMPLE_DATA.size());
400400
}
401401

402402
/**
@@ -412,11 +412,11 @@ public void primitiveSelectTest() throws Throwable {
412412
row = session.execute(execute_string).one();
413413

414414
value = SAMPLE_DATA.get(dataType);
415-
assertEquals(value, TestUtils.getValue(row, "k", dataType));
416-
assertEquals(value, TestUtils.getValue(row, "v", dataType));
415+
assertEquals(TestUtils.getValue(row, "k", dataType), value);
416+
assertEquals(TestUtils.getValue(row, "v", dataType), value);
417417
}
418-
assertEquals(15, SAMPLE_DATA.size());
419-
assertEquals(SAMPLE_DATA.size(), PRIMITIVE_SELECT_STATEMENTS.keySet().size());
418+
assertEquals(SAMPLE_DATA.size(), 15);
419+
assertEquals(PRIMITIVE_SELECT_STATEMENTS.keySet().size(), SAMPLE_DATA.size());
420420
}
421421

422422
/**
@@ -429,8 +429,8 @@ public void collectionInsertTest() throws Throwable {
429429
rs = session.execute(execute_string);
430430
assertTrue(rs.isExhausted());
431431
}
432-
assertEquals(255, SAMPLE_COLLECTIONS.size());
433-
assertEquals(SAMPLE_COLLECTIONS.size(), COLLECTION_INSERT_STATEMENTS.size());
432+
assertEquals(SAMPLE_COLLECTIONS.size(), 255);
433+
assertEquals(COLLECTION_INSERT_STATEMENTS.size(), SAMPLE_COLLECTIONS.size());
434434
}
435435

436436
/**
@@ -459,17 +459,17 @@ public void collectionSelectTest() throws Throwable {
459459
HashMap expectedMap = new HashMap();
460460
expectedMap.put(mapKey, mapValue);
461461

462-
assertEquals(SAMPLE_DATA.get(typeArgument2), TestUtils.getValue(row, "k", typeArgument2));
463-
assertEquals(expectedMap, TestUtils.getValue(row, "v", dataType));
462+
assertEquals(TestUtils.getValue(row, "k", typeArgument2), SAMPLE_DATA.get(typeArgument2));
463+
assertEquals(TestUtils.getValue(row, "v", dataType), expectedMap);
464464
} else {
465465
Object expectedValue = sampleValueMap.get(typeArgument1);
466466

467-
assertEquals(SAMPLE_DATA.get(typeArgument1), TestUtils.getValue(row, "k", typeArgument1));
468-
assertEquals(expectedValue, TestUtils.getValue(row, "v", dataType));
467+
assertEquals(TestUtils.getValue(row, "k", typeArgument1), SAMPLE_DATA.get(typeArgument1));
468+
assertEquals(TestUtils.getValue(row, "v", dataType), expectedValue);
469469
}
470470
}
471-
assertEquals(255, SAMPLE_COLLECTIONS.size());
472-
assertEquals(SAMPLE_COLLECTIONS.size(), COLLECTION_SELECT_STATEMENTS.keySet().size());
471+
assertEquals(SAMPLE_COLLECTIONS.size(), 255);
472+
assertEquals(COLLECTION_SELECT_STATEMENTS.keySet().size(), SAMPLE_COLLECTIONS.size());
473473
}
474474

475475
/**
@@ -505,7 +505,7 @@ public void tombstonesTest() throws Throwable {
505505
* Prints the table definitions that will be used in testing
506506
* (for exporting purposes)
507507
*/
508-
// TODO: @Test(groups = { "docs" })
508+
@Test(groups = { "docs" })
509509
public void printTableDefinitions() {
510510
// Prints the full list of table definitions
511511
for (String definition : getTableDefinitions()) {
@@ -517,7 +517,7 @@ public void printTableDefinitions() {
517517
* Prints the sample data that will be used in testing
518518
* (for exporting purposes)
519519
*/
520-
// TODO: @Test(groups = { "docs" })
520+
@Test(groups = { "docs" })
521521
public void printSampleData() {
522522
for (DataType dataType : SAMPLE_DATA.keySet()) {
523523
Object sampleValue = SAMPLE_DATA.get(dataType);
@@ -529,7 +529,7 @@ public void printSampleData() {
529529
* Prints the sample collections that will be used in testing
530530
* (for exporting purposes)
531531
*/
532-
// TODO: @Test(groups = { "docs" })
532+
@Test(groups = { "docs" })
533533
public void printSampleCollections() {
534534
for (DataType dataType : SAMPLE_COLLECTIONS.keySet()) {
535535
HashMap<DataType, Object> sampleValueMap = (HashMap<DataType, Object>) SAMPLE_COLLECTIONS.get(dataType);
@@ -554,7 +554,7 @@ public void printSampleCollections() {
554554
* Prints the simple insert statements that will be used in testing
555555
* (for exporting purposes)
556556
*/
557-
// TODO: @Test(groups = { "docs" })
557+
@Test(groups = { "docs" })
558558
public void printPrimitiveInsertStatements() {
559559
for (String execute_string : PRIMITIVE_INSERT_STATEMENTS) {
560560
System.out.println(execute_string);
@@ -565,7 +565,7 @@ public void printPrimitiveInsertStatements() {
565565
* Prints the simple select statements that will be used in testing
566566
* (for exporting purposes)
567567
*/
568-
// TODO: @Test(groups = { "docs" })
568+
@Test(groups = { "docs" })
569569
public void printPrimitiveSelectStatements() {
570570
for (String execute_string : PRIMITIVE_SELECT_STATEMENTS.values()) {
571571
System.out.println(execute_string);
@@ -576,7 +576,7 @@ public void printPrimitiveSelectStatements() {
576576
* Prints the simple insert statements that will be used in testing
577577
* (for exporting purposes)
578578
*/
579-
// TODO: @Test(groups = { "docs" })
579+
@Test(groups = { "docs" })
580580
public void printCollectionInsertStatements() {
581581
for (String execute_string : COLLECTION_INSERT_STATEMENTS) {
582582
System.out.println(execute_string);
@@ -587,7 +587,7 @@ public void printCollectionInsertStatements() {
587587
* Prints the simple insert statements that will be used in testing
588588
* (for exporting purposes)
589589
*/
590-
// TODO: @Test(groups = { "docs" })
590+
@Test(groups = { "docs" })
591591
public void printCollectionSelectStatements() {
592592
for (String execute_string : COLLECTION_SELECT_STATEMENTS.values()) {
593593
System.out.println(execute_string);

driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void roundRobinTest() throws Throwable {
127127
c.errorOut();
128128
throw e;
129129
} finally {
130-
coordinators.clear();
130+
coordinators.clear();
131131
c.discard();
132132
}
133133
}
@@ -152,7 +152,7 @@ public void DCAwareRoundRobinTest() throws Throwable {
152152
c.errorOut();
153153
throw e;
154154
} finally {
155-
coordinators.clear();
155+
coordinators.clear();
156156
c.discard();
157157
}
158158
}
@@ -197,7 +197,7 @@ public void tokenAwareTest(boolean usePrepared) throws Throwable {
197197
c.errorOut();
198198
throw e;
199199
} finally {
200-
coordinators.clear();
200+
coordinators.clear();
201201
c.discard();
202202
}
203203
}

driver-core/src/test/java/com/datastax/driver/core/PreparedStatementTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void preparedNativeTest2() {
133133
session.execute(setBoundValue(bs, name, type, getFixedValue2(type)));
134134

135135
Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_native'", name, ALL_NATIVE_TABLE)).one();
136-
assertEquals("For type " + type, getFixedValue2(type), getValue(row, name, type));
136+
assertEquals(getValue(row, name, type), getFixedValue2(type), "For type " + type);
137137
}
138138
}
139139

@@ -153,7 +153,7 @@ public void prepareListTest() {
153153
session.execute(setBoundValue(bs, name, type, value));
154154

155155
Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_list'", name, ALL_LIST_TABLE)).one();
156-
assertEquals(getValue(row, name, type), value,"For type " + type);
156+
assertEquals(getValue(row, name, type), value, "For type " + type);
157157
}
158158
}
159159

@@ -176,7 +176,7 @@ public void prepareListTest2() {
176176
session.execute(setBoundValue(bs, name, type, value));
177177

178178
Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_list'", name, ALL_LIST_TABLE)).one();
179-
assertEquals("For type " + type, value, getValue(row, name, type));
179+
assertEquals(getValue(row, name, type), value, "For type " + type);
180180
}
181181
}
182182

@@ -219,7 +219,7 @@ public void prepareSetTest2() {
219219
session.execute(setBoundValue(bs, name, type, value));
220220

221221
Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_set'", name, ALL_SET_TABLE)).one();
222-
assertEquals("For type " + type, value, getValue(row, name, type));
222+
assertEquals(getValue(row, name, type), value, "For type " + type);
223223
}
224224
}
225225

@@ -273,7 +273,7 @@ public void prepareMapTest2() {
273273
session.execute(setBoundValue(bs, name, type, value));
274274

275275
Row row = session.execute(String.format("SELECT %s FROM %s WHERE k='prepared_map'", name, ALL_MAP_TABLE)).one();
276-
assertEquals("For type " + type, value, getValue(row, name, type));
276+
assertEquals(getValue(row, name, type), value, "For type " + type);
277277
}
278278
}
279279
}
@@ -328,7 +328,7 @@ public void reprepareOnNewlyUpNodeNoKeyspaceTest() throws Exception {
328328
* Prints the table definitions that will be used in testing
329329
* (for exporting purposes)
330330
*/
331-
// TODO: @Test(groups = { "docs" })
331+
@Test(groups = { "docs" })
332332
public void printTableDefinitions() {
333333
for (String definition : getTableDefinitions()) {
334334
System.out.println(definition);

0 commit comments

Comments
 (0)