@@ -107,21 +107,31 @@ void testDpiMaskingConfig() {
107107 .withFailMessage ("withMaskingConfig() should overwrite the existing config and not append" )
108108 .hasSize (1 );
109109
110- var masking = DpiMasking .anonymization ().withRegex ("\\ d{3}-\\ d{2}-\\ d{4}" , "***-**-****" );
110+ var masking =
111+ DpiMasking .anonymization ()
112+ .withRegex ("\\ d{3}-\\ d{2}-\\ d{4}" , "***-**-****" )
113+ .withRegex ("\\ d{2}-\\ d{2}-\\ d{5}" , "**-**-*****" );
111114 config = config .withMaskingConfig (masking );
112115 assertThat (config .getMaskingConfig ()).isNotNull ();
113116 assertThat (((MaskingModuleConfigProviders ) config .getMaskingConfig ()).getProviders ())
114117 .hasSize (1 );
115118 dpiConfig = ((MaskingModuleConfigProviders ) config .getMaskingConfig ()).getProviders ().get (0 );
116119 assertThat (dpiConfig .getMethod ()).isEqualTo (DPIConfig .MethodEnum .ANONYMIZATION );
117- assertThat (dpiConfig .getEntities ()).hasSize (1 );
120+ assertThat (dpiConfig .getEntities ()).hasSize (2 );
118121 assertThat (((DPICustomEntity ) dpiConfig .getEntities ().get (0 )).getRegex ())
119122 .isEqualTo ("\\ d{3}-\\ d{2}-\\ d{4}" );
120123 assertThat (((DPICustomEntity ) dpiConfig .getEntities ().get (0 )).getReplacementStrategy ())
121124 .isEqualTo (
122125 DPIMethodConstant .create ()
123126 .method (DPIMethodConstant .MethodEnum .CONSTANT )
124127 .value ("***-**-****" ));
128+ assertThat (((DPICustomEntity ) dpiConfig .getEntities ().get (1 )).getRegex ())
129+ .isEqualTo ("\\ d{2}-\\ d{2}-\\ d{5}" );
130+ assertThat (((DPICustomEntity ) dpiConfig .getEntities ().get (1 )).getReplacementStrategy ())
131+ .isEqualTo (
132+ DPIMethodConstant .create ()
133+ .method (DPIMethodConstant .MethodEnum .CONSTANT )
134+ .value ("**-**-*****" ));
125135 }
126136
127137 @ Test
0 commit comments