@@ -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
@@ -1375,6 +1378,7 @@ public void hGetExMultipleFieldsReturnsValuesAndSetsExpiration() {
13751378 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
13761379 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
13771380 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , "field3" .getBytes ())).isTrue ();
1381+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
13781382 }
13791383
13801384 @ Test // GH-3211
@@ -1389,6 +1393,7 @@ public void hGetExMultipleFieldsWithNonExistentFields() {
13891393 assertThat (result .get (0 )).isEqualTo (VALUE_1_BYTES );
13901394 assertThat (result .get (1 )).isNull ();
13911395 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_2_BYTES )).isTrue ();
1396+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
13921397 }
13931398
13941399 @ Test // GH-3211
@@ -1403,6 +1408,7 @@ public void hSetExUpsertConditionSetsFieldsWithExpiration() {
14031408 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
14041409 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES );
14051410 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo (VALUE_2_BYTES );
1411+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14061412 }
14071413
14081414 @ Test // GH-3211
@@ -1417,6 +1423,7 @@ public void hSetExIfNoneExistConditionSucceedsWhenNoFieldsExist() {
14171423 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isTrue ();
14181424 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES );
14191425 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo (VALUE_2_BYTES );
1426+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14201427 }
14211428
14221429 @ Test // GH-3211
@@ -1431,6 +1438,7 @@ public void hSetExIfNoneExistConditionFailsWhenSomeFieldsExist() {
14311438 assertThat (result ).isFalse ();
14321439 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES ); // unchanged
14331440 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isFalse (); // not set
1441+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-1L );
14341442 }
14351443
14361444 @ Test // GH-3211
@@ -1446,6 +1454,7 @@ public void hSetExIfAllExistConditionSucceedsWhenAllFieldsExist() {
14461454 assertThat (result ).isTrue ();
14471455 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo ("new-value-1" .getBytes ()); // updated
14481456 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_3_BYTES )).isEqualTo ("new-value-2" .getBytes ()); // updated
1457+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isPositive ();
14491458 }
14501459
14511460 @ Test // GH-3211
@@ -1460,6 +1469,7 @@ public void hSetExIfAllExistConditionFailsWhenSomeFieldsMissing() {
14601469 assertThat (result ).isFalse ();
14611470 assertThat (clusterConnection .hashCommands ().hGet (KEY_1_BYTES , KEY_2_BYTES )).isEqualTo (VALUE_1_BYTES ); // unchanged
14621471 assertThat (clusterConnection .hashCommands ().hExists (KEY_1_BYTES , KEY_3_BYTES )).isFalse (); // not set
1472+ assertThat (clusterConnection .hashCommands ().hTtl (KEY_1_BYTES , KEY_2_BYTES ).get (0 )).isEqualTo (-1L );
14631473 }
14641474
14651475 @ Test // DATAREDIS-315
0 commit comments