File tree 1 file changed +17
-1
lines changed
src/test/java/com/intuit/fuzzymatcher/function
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 8
8
import java .text .ParseException ;
9
9
import java .text .SimpleDateFormat ;
10
10
import java .util .Date ;
11
+ import java .util .function .Function ;
11
12
12
13
import static com .intuit .fuzzymatcher .domain .ElementType .*;
13
14
@@ -20,12 +21,27 @@ public void itShouldRemoveSuffixFromName_Success(){
20
21
}
21
22
22
23
@ Test
23
- public void itShouldNotRemoveNameSuffixFromAddress_Success (){
24
+ public void itShouldPreprocessAddress (){
24
25
String value = "123 XYZ Ltd st, TX" ;
25
26
Element element = new Element .Builder ().setType (ADDRESS ).setValue (value ).createElement ();
26
27
Assert .assertEquals ("123 xyz ltd street texas" , element .getPreProcessedValue ());
27
28
}
28
29
30
+ @ Test
31
+ public void itShouldCustomPreprocessAddress (){
32
+ String value = "123_XYZ_Ltd_st, TX" ;
33
+ Function <String , String > customPreProcessing = (str -> str .replaceAll ("_" , " " ));
34
+ customPreProcessing = customPreProcessing .andThen (PreProcessFunction .addressPreprocessing ());
35
+
36
+ Element element = new Element .Builder ().setType (ADDRESS )
37
+ .setPreProcessingFunction (customPreProcessing )
38
+ .setValue (value )
39
+ .createElement ();
40
+
41
+ Assert .assertEquals ("123 xyz ltd street texas" , element .getPreProcessedValue ());
42
+ }
43
+
44
+
29
45
@ Test
30
46
public void itShouldGetNullString_Success (){
31
47
String value = " " ;
You can’t perform that action at this time.
0 commit comments