@@ -1336,6 +1336,7 @@ public void hGetExReturnsValueAndSetsExpiration() {
13361336 assertThat (result .get (0 )).isEqualTo (VALUE_1_BYTES );
13371337 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
13381338 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
1339+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
13391340 }
13401341
13411342 @ Test // GH-3211
@@ -1348,6 +1349,7 @@ public void hGetExReturnsNullWhenFieldDoesNotExist() {
13481349 assertThat (result ).hasSize (1 );
13491350 assertThat (result .get (0 )).isNull ();
13501351 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
1352+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-1L );
13511353 }
13521354
13531355 @ Test // GH-3211
@@ -1357,6 +1359,7 @@ public void hGetExReturnsNullWhenKeyDoesNotExist() {
13571359 List <byte []> result = clusterConnection .hashCommands ().hGetEx (KEY_1_BYTES , Expiration .seconds (60 ), KEY_2_BYTES );
13581360 assertThat (result ).hasSize (1 );
13591361 assertThat (result .get (0 )).isNull ();
1362+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-2L );
13601363 }
13611364
13621365 @ Test // GH-3211
@@ -1376,6 +1379,7 @@ public void hGetExMultipleFieldsReturnsValuesAndSetsExpiration() {
13761379 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
13771380 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
13781381 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , "field3" .getBytes ())).isTrue ();
1382+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
13791383 }
13801384
13811385 @ Test // GH-3211
@@ -1391,6 +1395,7 @@ public void hGetExMultipleFieldsWithNonExistentFields() {
13911395 assertThat (result .get (0 )).isEqualTo (VALUE_1_BYTES );
13921396 assertThat (result .get (1 )).isNull ();
13931397 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
1398+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
13941399 }
13951400
13961401 @ Test // GH-3211
@@ -1406,6 +1411,7 @@ public void hSetExUpsertConditionSetsFieldsWithExpiration() {
14061411 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
14071412 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES );
14081413 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo (VALUE_2_BYTES );
1414+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14091415 }
14101416
14111417 @ Test // GH-3211
@@ -1421,6 +1427,7 @@ public void hSetExIfNoneExistConditionSucceedsWhenNoFieldsExist() {
14211427 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
14221428 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES );
14231429 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo (VALUE_2_BYTES );
1430+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14241431 }
14251432
14261433 @ Test // GH-3211
@@ -1436,6 +1443,7 @@ public void hSetExIfNoneExistConditionFailsWhenSomeFieldsExist() {
14361443 assertThat (result ).isFalse ();
14371444 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES ); // unchanged
14381445 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isFalse (); // not set
1446+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-1L );
14391447 }
14401448
14411449 @ Test // GH-3211
@@ -1452,6 +1460,7 @@ public void hSetExIfAllExistConditionSucceedsWhenAllFieldsExist() {
14521460 assertThat (result ).isTrue ();
14531461 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo ("new-value-1" .getBytes ()); // updated
14541462 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo ("new-value-2" .getBytes ()); // updated
1463+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14551464 }
14561465
14571466 @ Test // GH-3211
@@ -1467,6 +1476,7 @@ public void hSetExIfAllExistConditionFailsWhenSomeFieldsMissing() {
14671476 assertThat (result ).isFalse ();
14681477 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES ); // unchanged
14691478 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isFalse (); // not set
1479+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-1L );
14701480 }
14711481
14721482 @ Test // DATAREDIS-315
0 commit comments