Skip to content

Commit 0d0119c

Browse files
committed
Add Duration sample to getFixedValue, filter Duration from UserTypesTest
1 parent 727f3de commit 0d0119c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ public static Object getFixedValue(final DataType type) {
347347
return true;
348348
case COUNTER:
349349
throw new UnsupportedOperationException("Cannot 'getSomeValue' for counters");
350+
case DURATION:
351+
return Duration.from("1h20m3s");
350352
case DECIMAL:
351353
return new BigDecimal("3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679");
352354
case DOUBLE:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ public void testPrimitiveDatatypes() throws Exception {
253253
case DOUBLE:
254254
alldatatypes.setDouble(index, ((Double) sampleData).doubleValue());
255255
break;
256+
case DURATION:
257+
alldatatypes.set(index, Duration.from(sampleData.toString()), Duration.class);
256258
case FLOAT:
257259
alldatatypes.setFloat(index, ((Float) sampleData).floatValue());
258260
break;
@@ -322,8 +324,9 @@ public void testNonPrimitiveDatatypes() throws Exception {
322324
"WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}");
323325
session().execute("USE test_nonprimitive_datatypes");
324326

325-
// counters are not allowed inside collections
327+
// counters and durations are not allowed inside collections
326328
DATA_TYPE_PRIMITIVES.remove(DataType.counter());
329+
DATA_TYPE_PRIMITIVES.remove(DataType.duration());
327330

328331
// create UDT
329332
List<String> alpha_type_list = new ArrayList<String>();

0 commit comments

Comments
 (0)