src/test/java/io/redisearch/client/ClientTest.java
@Test
    public void testPayloads() throws Exception {
        Client cl = getDefaultClient();

        Schema sc = new Schema().addTextField("title", 1.0);

        assertTrue(cl.createIndex(sc, Client.IndexOptions.defaultOptions()));

        Map<String, Object> fields = new HashMap<>();
        fields.put("title", "hello world");
        String payload = "foo bar";
        assertTrue(cl.addDocument("doc1", 1.0, fields, false, false, payload.getBytes()));

        SearchResult res = cl.search(new Query("hello world").setWithPayload());
        assertEquals(1, res.totalResults);
        assertEquals(1, res.docs.size());

        assertEquals(payload, new String(res.docs.get(0).getPayload()));
    }
// TODO: This test was broken in master branch
This test was broken in master branch
This test was broken in master branch
@Test
    public void testPayloads() throws Exception {
        Client cl = getDefaultClient();
        Schema sc = new Schema().addTextField("title", 1.0);
        assertTrue(cl.createIndex(sc, Client.IndexOptions.defaultOptions()));
        Map<String, Object> fields = new HashMap<>();
        fields.put("title", "hello world");
        String payload = "foo bar";
        assertTrue(cl.addDocument("doc1", 1.0, fields, false, false, payload.getBytes()));
        SearchResult res = cl.search(new Query("hello world").setWithPayload());
        assertEquals(1, res.totalResults);
        assertEquals(1, res.docs.size());
        assertEquals(payload, new String(res.docs.get(0).getPayload()));
    }
@ Test public void testPayloads ( ) throws Exception { Client cl = getDefaultClient ( ) ; Schema sc = new Schema ( ) . addTextField ( "title" , 1.0 ) ; assertTrue ( cl . createIndex ( sc , Client . IndexOptions . defaultOptions ( ) ) ) ; Map < String , Object > fields = new HashMap < > ( ) ; fields . put ( "title" , "hello world" ) ; String payload = "foo bar" ; assertTrue ( cl . addDocument ( "doc1" , 1.0 , fields , false , false , payload . getBytes ( ) ) ) ; SearchResult res = cl . search ( new Query ( "hello world" ) . setWithPayload ( ) ) ; assertEquals ( 1 , res . totalResults ) ; assertEquals ( 1 , res . docs . size ( ) ) ; assertEquals ( payload , new String ( res . docs . get ( 0 ) . getPayload ( ) ) ) ; }
TODO: This test was broken in master branch
TODO : This test was broken in master branch