@@ -1847,6 +1847,43 @@ public void readInnerListShouldNotInfluenceOuterWithSameNameWhenNull() {
18471847assertThat (outer .inners .get (0 ).values ).isEqualTo (Arrays .asList ("i-1" , "i-2" ));
18481848}
18491849
1850+ @ Test // DATAREDIS-911
1851+ public void writeEntityWithCustomConverter () {
1852+
1853+ this .converter = new MappingRedisConverter (null , null , resolverMock );
1854+ this .converter
1855+ .setCustomConversions (new RedisCustomConversions (Collections .singletonList (new AccountInfoToBytesConverter ())));
1856+ this .converter .afterPropertiesSet ();
1857+
1858+ AccountInfo accountInfo = new AccountInfo ();
1859+ accountInfo .setId ("ai-id-1" );
1860+ accountInfo .setAccount ("123456" );
1861+ accountInfo .setAccountName ("Inamur Rahman Sadid" );
1862+
1863+ assertThat (write (accountInfo ).getRedisData ().getId ()).isEqualTo (accountInfo .getId ());
1864+ }
1865+
1866+ @ Test // DATAREDIS-911
1867+ public void readEntityWithCustomConverter () {
1868+
1869+ this .converter = new MappingRedisConverter (null , null , resolverMock );
1870+ this .converter
1871+ .setCustomConversions (new RedisCustomConversions (Collections .singletonList (new BytesToAccountInfoConverter ())));
1872+ this .converter .afterPropertiesSet ();
1873+
1874+ Bucket bucket = new Bucket ();
1875+ bucket .put ("_raw" , "ai-id-1|123456|Golam Mazid Sajib" .getBytes (StandardCharsets .UTF_8 ));
1876+
1877+ RedisData redisData = new RedisData (bucket );
1878+ redisData .setKeyspace (KEYSPACE_ACCOUNT );
1879+ redisData .setId ("ai-id-1" );
1880+
1881+ AccountInfo target = converter .read (AccountInfo .class , redisData );
1882+
1883+ assertThat (target .getAccount ()).isEqualTo ("123456" );
1884+ assertThat (target .getAccountName ()).isEqualTo ("Golam Mazid Sajib" );
1885+ }
1886+
18501887private RedisTestData write (Object source ) {
18511888
18521889RedisData rdo = new RedisData ();
@@ -1947,43 +1984,6 @@ public Address convert(byte[] value) {
19471984}
19481985}
19491986
1950- @ Test // DATAREDIS-911
1951- public void writeEntityWithCustomConverter () {
1952-
1953- this .converter = new MappingRedisConverter (null , null , resolverMock );
1954- this .converter
1955- .setCustomConversions (new RedisCustomConversions (Collections .singletonList (new AccountInfoToBytesConverter ())));
1956- this .converter .afterPropertiesSet ();
1957-
1958- AccountInfo accountInfo = new AccountInfo ();
1959- accountInfo .setId ("ai-id-1" );
1960- accountInfo .setAccount ("123456" );
1961- accountInfo .setAccountName ("Inamur Rahman Sadid" );
1962-
1963- assertThat (write (accountInfo ).getRedisData ().getId ()).isEqualTo (accountInfo .getId ());
1964- }
1965-
1966- @ Test // DATAREDIS-911
1967- public void readEntityWithCustomConverter () {
1968-
1969- this .converter = new MappingRedisConverter (null , null , resolverMock );
1970- this .converter
1971- .setCustomConversions (new RedisCustomConversions (Collections .singletonList (new BytesToAccountInfoConverter ())));
1972- this .converter .afterPropertiesSet ();
1973-
1974- Bucket bucket = new Bucket ();
1975- bucket .put ("_raw" , "ai-id-1|123456|Golam Mazid Sajib" .getBytes (StandardCharsets .UTF_8 ));
1976-
1977- RedisData redisData = new RedisData (bucket );
1978- redisData .setKeyspace (KEYSPACE_ACCOUNT );
1979- redisData .setId ("ai-id-1" );
1980-
1981- AccountInfo target = converter .read (AccountInfo .class , redisData );
1982-
1983- assertThat (target .getAccount ()).isEqualTo ("123456" );
1984- assertThat (target .getAccountName ()).isEqualTo ("Golam Mazid Sajib" );
1985- }
1986-
19871987@ WritingConverter
19881988static class AccountInfoToBytesConverter implements Converter <AccountInfo , byte []> {
19891989
0 commit comments