Skip to content

Commit bba531a

Browse files
committed
docs: Updated README
1 parent a66bf10 commit bba531a

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

README.adoc

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ dependencies {
4141
@Testcontainers
4242
public class RedisExampleTest {
4343
44-
@Container
45-
private static RedisContainer redisContainer = new RedisContainer(
46-
RedisContainer.DEFAULT_IMAGE_NAME.withTag(RedisContainer.DEFAULT_TAG));
44+
@Container
45+
private static RedisContainer container = new RedisContainer(
46+
RedisContainer.DEFAULT_IMAGE_NAME.withTag(RedisContainer.DEFAULT_TAG));
4747
48-
@Test
49-
void testSomethingUsingLettuce() {
50-
// Retrieve the Redis URI from the container
51-
String redisURI = redisContainer.getRedisURI();
52-
RedisClient client = RedisClient.create(redisURI);
53-
try (StatefulRedisConnection<String, String> connection = client.connect()) {
54-
RedisCommands<String, String> commands = connection.sync();
55-
Assertions.assertEquals("PONG", commands.ping());
56-
}
57-
}
48+
@Test
49+
void testSomethingUsingLettuce() {
50+
// Retrieve the Redis URI from the container
51+
String redisURI = container.getRedisURI();
52+
RedisClient client = RedisClient.create(redisURI);
53+
try (StatefulRedisConnection<String, String> connection = client.connect()) {
54+
RedisCommands<String, String> commands = connection.sync();
55+
Assertions.assertEquals("PONG", commands.ping());
56+
}
57+
}
5858
}
5959
----
6060

@@ -64,19 +64,22 @@ public class RedisExampleTest {
6464
@Testcontainers
6565
class RedisStackExampleTest {
6666
67-
@Container
68-
private static RedisStackContainer redisContainer = new RedisStackContainer(
69-
RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(RedisStackContainer.DEFAULT_TAG));
67+
@Container
68+
private static RedisStackContainer container = new RedisStackContainer(
69+
RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(RedisStackContainer.DEFAULT_TAG));
7070
71-
@Test
72-
void testSomethingUsingLettuceMod() {
73-
// Retrieve the Redis URI from the container
74-
String redisURI = redisContainer.getRedisURI();
75-
RedisModulesClient client = RedisModulesClient.create(redisURI);
76-
try (StatefulRedisModulesConnection<String, String> connection = client.connect()) {
77-
RedisModulesCommands<String, String> commands = connection.sync();
78-
Assertions.assertEquals("PONG", commands.ping());
79-
}
80-
}
71+
@Test
72+
void testSomethingUsingLettuceMod() {
73+
// Retrieve the Redis URI from the container
74+
String redisURI = container.getRedisURI();
75+
RedisModulesClient client = RedisModulesClient.create(redisURI);
76+
try (StatefulRedisModulesConnection<String, String> connection = client.connect()) {
77+
RedisModulesCommands<String, String> commands = connection.sync();
78+
commands.ftCreate("myIndex", Field.tag("myField").build());
79+
IndexInfo indexInfo = RedisModulesUtils.indexInfo(commands.ftInfo("myIndex"));
80+
Assertions.assertEquals(1, indexInfo.getFields().size());
81+
Assertions.assertEquals("myField", indexInfo.getFields().get(0).getName());
82+
}
83+
}
8184
}
8285
----

0 commit comments

Comments
 (0)