File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed
src/test/java/ru/fusionsoft/dbgit Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ package ru .fusionsoft .dbgit .core ;
2+
3+ import ru .fusionsoft .dbgit .utils .MaskFilter ;
4+
5+ import java .util .HashMap ;
6+ import java .util .Map ;
7+ import org .junit .jupiter .api .*;
8+ import static org .junit .jupiter .api .Assertions .*;
9+
10+ public class DBGitIgnoreTest {
11+
12+ DBGitIgnore dbGitIgnore ;
13+ Map <String , MaskFilter > filters = new HashMap <>();
14+ Map <String , MaskFilter > exclusions = new HashMap <>();
15+ String textTbl = "public/ad_group_roles.tbl" ;
16+
17+ private void createDbGitIgnore (){
18+ dbGitIgnore = new DBGitIgnore (filters , exclusions );
19+ addExcl ("public/*.*" );
20+ }
21+
22+ private void addFilter (String mask ){ filters .put (mask , new MaskFilter (mask )); }
23+ private void addExcl (String mask ){ exclusions .put (mask , new MaskFilter (mask )); }
24+
25+
26+
27+ @ Test
28+ public void matchOne () {
29+ createDbGitIgnore ();
30+ assertFalse (dbGitIgnore .matchOne (textTbl ));
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package ru .fusionsoft .dbgit .utils ;
2+
3+ import org .junit .jupiter .api .*;
4+ import static org .junit .jupiter .api .Assertions .*;
5+
6+ public class MaskFilterTest {
7+
8+ @ Test
9+ public void match () {
10+ MaskFilter mf = new MaskFilter ("pub*.*" );
11+
12+ String textTbl = "public/ad_group_roles.tbl" ;
13+ String textCsv = "public/ad_group_roles.csv" ;
14+
15+ assertTrue (mf .match (textTbl ));
16+ assertTrue (mf .match (textCsv ));
17+ }
18+
19+ @ Test
20+ public void matchExtention () {
21+ MaskFilter mfCsv = new MaskFilter ("pub*lic*.csv" );
22+
23+ String textTbl = "public/ad_group_roles.tbl" ;
24+ String textCsv = "public/ad_group_roles.csv" ;
25+
26+ assertFalse (mfCsv .match (textTbl ));
27+ assertTrue (mfCsv .match (textCsv ));
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments