@@ -1847,6 +1847,43 @@ public void readInnerListShouldNotInfluenceOuterWithSameNameWhenNull() {
1847
1847
assertThat (outer .inners .get (0 ).values ).isEqualTo (Arrays .asList ("i-1" , "i-2" ));
1848
1848
}
1849
1849
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
+
1850
1887
private RedisTestData write (Object source ) {
1851
1888
1852
1889
RedisData rdo = new RedisData ();
@@ -1947,43 +1984,6 @@ public Address convert(byte[] value) {
1947
1984
}
1948
1985
}
1949
1986
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
-
1987
1987
@ WritingConverter
1988
1988
static class AccountInfoToBytesConverter implements Converter <AccountInfo , byte []> {
1989
1989
0 commit comments